//,string dept_no
    public static DataSet GetDept(string fact_no)
    {
        bs_UserInfo mybs = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"]);

        PccMsg myMsg = new PccMsg();
        myMsg.CreateFirstNode("fact_no", fact_no);
          //  myMsg.CreateFirstNode("dept_no", dept_no);
        return mybs.DoReturnDataSet("GETDEPTBYFACT", myMsg.GetXmlStr, "");
    }
    public static void _Get_ControlDeptByfact(DropDownList ddl, string fact_no)
    {
        bs_UserInfo mybs = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"]);
        PccMsg myMsg = new PccMsg();
        myMsg.CreateFirstNode("fact_no", fact_no);
        DataSet dsReturn = mybs.DoReturnDataSet("GETDEPTBYFACT", myMsg.GetXmlStr, "");

        DataTable dt = dsReturn.Tables[0];
        ddl.SelectedIndex = -1;
        ddl.DataSource = dt;

        ddl.DataTextField = "dept_no";
        ddl.DataValueField = "dept_no";
        ddl.DataBind();
          //  ddl.Items.Insert(0, new ListItem("--All--", ""));
    }
    //web.huuminh 20140416
    // lây dept dua vào uer_id
    public static void _Get_ControlDept(DropDownList ddl, string UserID,string Type)
    {
        bs_UserInfo mybs = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"]);
        PccMsg myMsg = new PccMsg();
        myMsg.CreateFirstNode("UserID", UserID);
        DataSet dsReturn = mybs.DoReturnDataSet("GETDEPTBYUSERID", myMsg.GetXmlStr, "");

        DataTable dt = dsReturn.Tables[0];
        ddl.SelectedIndex = -1;
        ddl.DataSource = dt;
        if (Type == "1")
        {
            ddl.DataTextField = "dept_name";
            ddl.DataValueField = "dept_no";
        }
        ddl.DataBind();
        //if (dt.Rows.Count > 1 || dt.Rows.Count == 0)
        //    ddl.Items.Insert(0, new ListItem("--All--", ""));
    }
    public void GetImageFile(string IdImage)
    {
        //if (Session["IdImage"].ToString() != null)
        //{

            bs_UserInfo bs_Route = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"], "", ConfigurationSettings.AppSettings["EventLogPath"]);
            PccMsg myMsg = new PccMsg();
            myMsg.CreateFirstNode("user_id", IdImage.ToString().Trim());
            string strXML = myMsg.GetXmlStr;
            DataTable ImageTable = bs_Route.DoReturnDataSet("GETUSERNAMESIGN", strXML, "").Tables[0];
            //return dt;
            byte[] byteReturn = { };

            if (ImageTable.Rows.Count > 0)
            {
                byteReturn = (byte[])ImageTable.Rows[0]["sign_pic"];
                Response.BinaryWrite(byteReturn);
            }

          //  }
    }
    //string fact_no,
    private DataTable Get_SecByDept(string dept_no)
    {
        xmlFact_no = _DropDownList.GetFactNoByUserID(Session["UserID"].ToString().Trim());
        bs_UserInfo mybs = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"]);
        PccMsg myMsg = new PccMsg();
        myMsg.CreateFirstNode("fact_no", xmlFact_no.ToString());
        myMsg.CreateFirstNode("dept_no", dept_no.Trim());
        DataSet dsReturn = mybs.DoReturnDataSet("GETSECBYDEPT", myMsg.GetXmlStr, "");

        DataTable dt = dsReturn.Tables[0];
        return dt;
    }
    private void GetContact()
    {
        string area_no = ConfigurationSettings.AppSettings["area_no"];
        string ap_id = ConfigurationSettings.AppSettings["ApID"];
        PccMsg myMsg = new PccMsg();
        myMsg.CreateFirstNode("area_no", area_no);
        myMsg.CreateFirstNode("ap_id", ap_id);
        bs_UserInfo mybs = new bs_UserInfo(ConfigurationSettings.AppSettings["ConnectionType"], ConfigurationSettings.AppSettings["ConnectionServer"], ConfigurationSettings.AppSettings["ConnectionDB"], ConfigurationSettings.AppSettings["ConnectionUser"], ConfigurationSettings.AppSettings["ConnectionPwd"]);
        DataSet ds = mybs.DoReturnDataSet("GET_CONTACT_SYSMANAGE", myMsg.GetXmlStr, "");
        DataTable dt = ds.Tables[0];

        dtlContact.DataSource = dt;
        dtlContact.DataBind();
    }
    public static void _Get_ControlSecByDept(DropDownList ddl, string fact_no,string dept_no)
    {
        bs_UserInfo mybs = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"]);
        PccMsg myMsg = new PccMsg();
        myMsg.CreateFirstNode("fact_no", fact_no);
        myMsg.CreateFirstNode("dept_no", dept_no);
        DataSet dsReturn = mybs.DoReturnDataSet("GETSECBYDEPT", myMsg.GetXmlStr, "");

        //DataTable dt = dsReturn.Tables[0];
        //ddl.SelectedIndex = -1;
        //ddl.DataSource = dt;

        //ddl.DataTextField = "sec_no";
        //ddl.DataValueField = "sec_no";

        //ddl.DataBind();
    }
    private DataTable Get_QCbySec( string dept_no,string sec_no)
    {
        //  xmlFact_no = _DropDownList.GetFactNoByUserID(Session["UserID"].ToString().Trim());
        bs_UserInfo mybs = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"]);
        PccMsg myMsg = new PccMsg();
        xmlFact_no = _DropDownList.GetFactNoByUserID(Session["UserID"].ToString().Trim());
        // myMsg.CreateFirstNode("user_id", xmlUserID.Trim());
        myMsg.CreateFirstNode("fact_no", xmlFact_no.ToString());
        myMsg.CreateFirstNode("dept_no", dept_no);// ddlDeptNo.SelectedValue.ToString()
        myMsg.CreateFirstNode("sec_no", sec_no.Trim());
        DataSet dsReturn = mybs.DoReturnDataSet("GETQCCODINH", myMsg.GetXmlStr, "");

           DataTable dt = dsReturn.Tables[0];

        return dt;
    }
 public DataTable GetUserNameSign()
 {
     bs_UserInfo bs_Route = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"], "", ConfigurationSettings.AppSettings["EventLogPath"]);
     PccMsg myMsg = new PccMsg();
     myMsg.CreateFirstNode("user_id", Session["UserID"].ToString().Trim());
     string strXML = myMsg.GetXmlStr;
     DataTable dt = bs_Route.DoReturnDataSet("GETUSERNAMESIGN", strXML, "").Tables[0];
     return dt;
 }
    public static DataSet GetSumQty(string fact_no, string dept_no, string sec_no, string userQC_id, string start_date, string end_date)
    {
        bs_UserInfo bs_Route = new bs_UserInfo(ConfigurationSettings.AppSettings["AppConnectionType"], ConfigurationSettings.AppSettings["AppConnectionServer"], ConfigurationSettings.AppSettings["AppConnectionDB"], ConfigurationSettings.AppSettings["AppConnectionUser"], ConfigurationSettings.AppSettings["AppConnectionPwd"], "", ConfigurationSettings.AppSettings["EventLogPath"]);
        PccMsg myMsg = new PccMsg();

        myMsg.CreateFirstNode("fact_no", fact_no);
        myMsg.CreateFirstNode("dept_no", dept_no);
        myMsg.CreateFirstNode("sec_no", sec_no);
        myMsg.CreateFirstNode("userQC_id", userQC_id);
        myMsg.CreateFirstNode("start_date", start_date);
        myMsg.CreateFirstNode("end_date", end_date);

        string strXML = myMsg.GetXmlStr;
        return  bs_Route.DoReturnDataSet("SUMQTY", strXML, "");
    }