using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Globalization;

namespace CheckSheet.approve
{
    public partial class Confirm_delete_equ : System.Web.UI.Page
    {
        [System.Web.Services.WebMethod]
        public static string confirmdelete(string parahd)
        {
            string cmd = string.Empty;
            byte[] datahd = System.Convert.FromBase64String(parahd);
            string base64Decoded = System.Text.ASCIIEncoding.UTF8.GetString(datahd);
            string[] strmt = base64Decoded.Split('|');
            try
            {



                string userapproveid = strmt[0].ToString();
                string lineid = strmt[1].ToString();
                string partnumber = strmt[2].ToString();
                string machineid = strmt[3].ToString();

                userapproveid =  clsControlUI.getEmpName(userapproveid);

                using (FcSql.Function fc = new FcSql.Function())
                {
                    string str_del = string.Format("update EquipmentList set flagdel=1,update_user='{3}',update_datetime='{4}' Where linegroupid='{0}' and partnumber='{1}' and machineid='{2}'", lineid, partnumber, machineid, userapproveid, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", new CultureInfo("en-US")));
                    cmd = fc.ExecSQLStatement(str_del.ToString());


                    str_del = string.Format("update MachineMaster set flagdel=1,update_user='{3}',update_datetime='{4}' Where  machineid='{2}'", lineid, partnumber, machineid, userapproveid, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", new CultureInfo("en-US")));
                    cmd = fc.ExecSQLStatement(str_del.ToString());
                }

            }
            catch { }
            return cmd;

        }


        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}