protected void btnImport_Click(object sender, EventArgs e)
    {
        string strFileName = ConfigurationManager.AppSettings["UploadPath"] + this.ddlEnterpriseID.SelectedValue + @"\Logistics\Prod_Logistics.xls";
        if (!System.IO.File.Exists(strFileName))
        {
            JScript.Instance.ShowMessage(this.updatePanel, Resources.Resource.EP_ProductLogisticsExcelNotExists);
            return;
        }

        Js.BLL.Enterprise.CheckDal dal = new Js.BLL.Enterprise.CheckDal(FormID, cnKey);
        DataTable dt = dal.ImportProductLogistics1(Session["EnterpriseID"].ToString(), Session["User"].ToString());

        DataTable dtTemp = dal.GetProductLogisticsTemp("1=2");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow dr = dtTemp.NewRow();
            dr["UserName"] = Session["User"].ToString();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            dtTemp.Rows.Add(dr);
        }

        dal.SaveProductLogistics(dtTemp, Session["User"].ToString());
        SetBtnEnabled("");
    }
    protected void btnCompare_Click(object sender, EventArgs e)
    {
        Js.BLL.Enterprise.CheckDal dal = new Js.BLL.Enterprise.CheckDal(FormID, cnKey);

        dal.UpdateCheckState(Session["EnterpriseID"].ToString());
        SetBtnEnabled("");
    }
    protected void btnCheck_Click(object sender, EventArgs e)
    {
        Js.BLL.Enterprise.CheckDal dal = new Js.BLL.Enterprise.CheckDal(FormID, cnKey);
        dal.Check(this.ddlEnterpriseID.SelectedValue, Session["User"].ToString());

        SetBtnEnabled("");
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["cnKey"] != null)
         cnKey = Session["cnKey"].ToString();
     EnterpriseID = Request.QueryString["EnterpriseID"] + "";
     FormID = Request.QueryString["FormID"] + "";
     LogisticsID = Request.QueryString["ID"] + "";
     if (!IsPostBack)
     {
         Js.BLL.Enterprise.CheckDal cdal = new Js.BLL.Enterprise.CheckDal(FormID, cnKey);
         string filter = string.Format("EnterpriseID= '{0}' and LogisticsID='{1}'", EnterpriseID, LogisticsID);
         DataTable dt = cdal.GetModifyRecord(FormID,filter);
         this.GridView1.DataSource = dt.DefaultView;
         this.GridView1.DataBind();
     }
 }
    private void BindGrid()
    {
        Js.BLL.BaseDal bdal = new Js.BLL.BaseDal(FormID);
        DataTable dtSub = bdal.GetSubDetail("").Tables[0];

        Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal();

        if (Session["UserType"].ToString() == "BU")
        {
            //營運用戶
            DataTable dt = dal.GetAllUsers().Tables[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["UserName"].ToString() != Session["User"].ToString())
                {
                    DataRow dr = dtSub.NewRow();
                    dr["AnnounceID"] = this.txtAnnounceID.Text;
                    dr["ReceiverUserName"] = dt.Rows[i]["UserName"];
                    dr["ReceiverFlag"] = 0;
                    Js.BLL.BusinessUnit.CompanyDal cdal = new Js.BLL.BusinessUnit.CompanyDal();
                    Js.Model.BusinessUnit.CompanyInfo model = cdal.GetModel();

                    dr["ReceiveUnitNo"] = model.CompanyNo;
                    dr["Receiver"] = dt.Rows[i]["PersonName"];

                    dtSub.Rows.Add(dr);
                }
            }
            //各企業用戶
            DataTable dtEP = dal.GetEnterprise();
            for (int i = 0; i < dtEP.Rows.Count; i++)
            {
                Js.BLL.Account.UserDal edal = new Js.BLL.Account.UserDal(dtEP.Rows[i]["EnterpriseID"].ToString());
                DataTable dtUser = edal.GetAllUsers().Tables[0];
                for (int j = 0; j < dtUser.Rows.Count; j++)
                {
                    DataRow dr = dtSub.NewRow();
                    dr["AnnounceID"] = this.txtAnnounceID.Text;
                    dr["ReceiverUserName"] = dtUser.Rows[j]["UserName"];
                    dr["ReceiverFlag"] = 1;
                    dr["ReceiveUnitNo"] = dtEP.Rows[i]["EnterpriseID"].ToString();
                    dr["Receiver"] = dtUser.Rows[j]["PersonName"];

                    dtSub.Rows.Add(dr);
                }
            }
        }
        else
        {
            Js.BLL.Account.UserDal edal = new Js.BLL.Account.UserDal(Session["EnterpriseID"].ToString());
            DataTable dtUser = edal.GetAllUsers().Tables[0];
            for (int i = 0; i < dtUser.Rows.Count; i++)
            {
                if (dtUser.Rows[i]["UserName"].ToString() != Session["User"].ToString())
                {
                    DataRow dr = dtSub.NewRow();
                    dr["AnnounceID"] = this.txtAnnounceID.Text;
                    dr["ReceiverUserName"] = dtUser.Rows[i]["UserName"];
                    dr["ReceiverFlag"] = 1;
                    dr["ReceiveUnitNo"] = Session["EnterpriseID"].ToString();
                    dr["Receiver"] = dtUser.Rows[i]["PersonName"];

                    dtSub.Rows.Add(dr);
                }
            }
            //營運管理用戶
            Js.BLL.Enterprise.CheckDal checkdal = new Js.BLL.Enterprise.CheckDal();
            dtUser = checkdal.GetManagerUser(Session["EnterpriseID"].ToString());

            Js.BLL.BusinessUnit.CompanyDal cdal = new Js.BLL.BusinessUnit.CompanyDal();
            Js.Model.BusinessUnit.CompanyInfo model = cdal.GetModel();

            for (int i = 0; i < dtUser.Rows.Count; i++)
            {
                DataRow dr = dtSub.NewRow();
                dr["AnnounceID"] = this.txtAnnounceID.Text;
                dr["ReceiverUserName"] = dtUser.Rows[i]["UserName"];
                dr["ReceiverFlag"] = 0;
                dr["ReceiveUnitNo"] = model.CompanyNo;
                dr["Receiver"] = dtUser.Rows[i]["PersonName"];

                dtSub.Rows.Add(dr);
            }
        }
        this.GridView1.DataSource = dtSub.DefaultView;
        this.GridView1.DataBind();
    }
Exemple #6
0
    public string IsExistsByFilter(string FormID, string EnterpriseID, string ID, string cnKey)
    {
        ID = Server.UrlDecode(ID);
        EnterpriseID = Server.UrlDecode(EnterpriseID);
        string filter = string.Format("EnterpriseID='{0}'", EnterpriseID);

        Js.BLL.BaseDal dal = new Js.BLL.BaseDal(FormID, cnKey);
        Js.BLL.Enterprise.CheckDal cdal = new Js.BLL.Enterprise.CheckDal(FormID, cnKey);

        byte strTemp = 0;
        if (ID.Length > 0)
        {
            if (dal.Exists(ID, filter))
                strTemp = 1;
            else
                strTemp = 0;
        }
        if (FormID == "EP_Department" || FormID == "EP_Person")
        { }
        else
        {
            if (strTemp == 0)
            {
                if (cdal.IsEnterpriseChecked(EnterpriseID))
                    strTemp = 2;
            }
        }
        return strTemp.ToString();
    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        Js.BLL.Enterprise.CheckDal dal = new Js.BLL.Enterprise.CheckDal(FormID, cnKey);

        dal.UpoladBusinessUnit(Session["EnterpriseID"].ToString(), Session["User"].ToString());
        this.txtUploadDate.Text = Js.Com.PageValidate.ParseDateTime(DateTime.Now.ToString());
        SetBtnEnabled("");
        JScript.Instance.ShowMessage(this.updatePanel, Resources.Resource.EP_ProductLogisticsUploadSuccess);
    }
 protected void btnUnCheck_Click(object sender, EventArgs e)
 {
     Js.BLL.Enterprise.CheckDal dal = new Js.BLL.Enterprise.CheckDal(FormID, cnKey);
     dal.UnCheck(this.ddlEnterpriseID.SelectedValue);
     this.txtUploadDate.Text = "";
     SetBtnEnabled("");
 }