protected void Page_Load(object sender, EventArgs e)
        {
            if (!(null == Session["totleAuthority"]))
            {
                AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"];

                bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.custManager);
                if (!flag)
                {
                    Response.Redirect("~/Main/NoAuthority.aspx");
                }
            }
            else
            {
                string url = Request.FilePath;
                Session["backUrl"] = url;
                Response.Redirect("~/Account/Login.aspx");
            }

            if (!IsPostBack)
            {
                DataSet         MyDst  = new DataSet();
                SupplierProcess myView = new SupplierProcess(MyDst);

                myView.RealSupplierView();
                DataTable taskTable = myView.MyDst.Tables["tbl_supplier_company"];

                Session["SupplierProcess"] = myView;
                Session["dtSources"]       = taskTable;


                supplierGV.DataSource = Session["dtSources"];
                supplierGV.DataBind();
            }
        }
Beispiel #2
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            if (inputCheck())
            {
                string sn = txtSupplierName.Text.ToString().Trim();
                string sa = txtSupplierAddr.Text.ToString().Trim();

                #region dataset
                DataSet dataSet     = new DataSet();
                DataRow supplierRow = null;

                DataColumn colSupplierName = new DataColumn("supplierName", System.Type.GetType("System.String"));
                DataColumn colSupplierAddr = new DataColumn("supplierAddress", System.Type.GetType("System.String"));

                DataTable supplierTable = new DataTable("tbl_supplier_company");

                supplierTable.Columns.Add(colSupplierName);
                supplierTable.Columns.Add(colSupplierAddr);

                supplierRow = supplierTable.NewRow();
                supplierRow["supplierName"]    = sn;
                supplierRow["supplierAddress"] = sa;
                supplierTable.Rows.Add(supplierRow);

                dataSet.Tables.Add(supplierTable);
                #endregion

                DataSet         dsCheck = new DataSet();
                SupplierProcess sp      = new SupplierProcess(dsCheck);

                sp.RealSupplierView();
                int rowRtn = -1;

                sp.DoCheckSupplierName(sn);
                rowRtn = sp.IntRtn;
                if (0 == rowRtn)
                {
                    sp.MyDst = dataSet;

                    sp.Add();

                    Response.Redirect("~/Main/custInfoManager/supplierManager/supplierEdit.aspx");
                }
                else
                {
                    lblSupplierName.Text = "公司名已存在!";
                }
            }
        }
        protected void btnAcceptDel_Click(object sender, EventArgs e)
        {
            int       dataIndex = supplierGV.SelectedRow.DataItemIndex;
            DataTable dt        = (DataTable)Session["dtSources"];
            string    depId     = dt.DefaultView[dataIndex].Row["supplierId"].ToString();

            Button btn = null;

            btn         = (supplierGV.SelectedRow.FindControl("btnUpdate") as Button);
            btn.Visible = false;
            btn         = (supplierGV.SelectedRow.FindControl("btnCancle") as Button);
            btn.Visible = false;
            btn         = (supplierGV.SelectedRow.FindControl("btnSupplierManEdit") as Button);
            btn.Visible = false;
            btn         = (supplierGV.SelectedRow.FindControl("btnDel") as Button);
            btn.Visible = false;
            btn         = sender as Button;
            btn.Visible = false;
            btn         = btnDelCancel;
            btn.Visible = false;

            SupplierProcess sp = Session["SupplierProcess"] as SupplierProcess;

            sp.SupplierDel(depId);

            sp.RealSupplierView();

            DataTable taskTable = sp.MyDst.Tables["tbl_supplier_company"];

            Session["dtSources"]  = sp.MyDst.Tables["tbl_supplier_company"] as DataTable;
            supplierGV.DataSource = Session["dtSources"];

            supplierGV.SelectedIndex = -1;
            supplierGV.EditIndex     = -1;
            supplierGV.DataBind();

            supplierGV.Enabled = true;
            btnAdd.Visible     = true;
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!(null == Session["totleAuthority"]))
            {
                AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"];

                bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.newContract);
                if (!flag)
                {
                    Response.Redirect("~/Main/NoAuthority.aspx");
                }
            }
            else
            {
                string url = Request.FilePath;
                Session["backUrl"] = url;
                Response.Redirect("~/Account/Login.aspx");
            }

            if (!IsPostBack)
            {
                #region subContractTable
                DataTable subContractTable = null;
                if (null == Session["subContractTable"])
                {
                    DataRow subContractRow = null;

                    DataColumn colMainContractId = new DataColumn("mainContractId", System.Type.GetType("System.String"));
                    DataColumn colSupplierIdName = new DataColumn("supplierId", System.Type.GetType("System.String"));
                    DataColumn colSubContractTag = new DataColumn("subContractTag", System.Type.GetType("System.String"));
                    DataColumn colCash           = new DataColumn("cash", System.Type.GetType("System.String"));
                    DataColumn colDateLine       = new DataColumn("dateLine", System.Type.GetType("System.String"));
                    DataColumn colPaymentMode    = new DataColumn("paymentMode", System.Type.GetType("System.String"));

                    subContractTable = new DataTable("tbl_subContract");

                    subContractTable.Columns.Add(colMainContractId);
                    subContractTable.Columns.Add(colSupplierIdName);
                    subContractTable.Columns.Add(colSubContractTag);
                    subContractTable.Columns.Add(colCash);
                    subContractTable.Columns.Add(colDateLine);
                    subContractTable.Columns.Add(colPaymentMode);

                    DataRow sessionDr      = Session["selMainContractDr"] as DataRow;
                    string  mainContractId = sessionDr["mainContractId"].ToString();

                    subContractRow = subContractTable.NewRow();
                    subContractRow["mainContractId"] = mainContractId;
                    subContractRow["supplierId"]     = -1;
                    subContractRow["subContractTag"] = string.Empty;
                    subContractRow["cash"]           = string.Empty;
                    subContractRow["dateLine"]       = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff");
                    subContractRow["paymentMode"]    = string.Empty;
                    subContractTable.Rows.Add(subContractRow);

                    Session["subContractTable"] = subContractTable;
                }
                else
                {
                    subContractTable = Session["subContractTable"] as DataTable;
                }

                txtSubContractTag.Text = subContractTable.Rows[0]["subContractTag"].ToString();
                txtMoney.Text          = subContractTable.Rows[0]["cash"].ToString();
                btnDate.Text           = subContractTable.Rows[0]["dateLine"].ToString();
                txtPayment.Text        = subContractTable.Rows[0]["paymentMode"].ToString();
                #endregion

                #region subProductGV
                if (null == Session["subProductSelDs"])
                {
                }
                else
                {
                    DataTable dt = Session["subProductSelDs"] as DataTable;

                    string strFilter =
                        " checkOrNot = " + "'" + bool.TrueString + "'";
                    dt.DefaultView.RowFilter = strFilter;
                    subProductGV.DataSource  = dt;
                    subProductGV.DataBind();
                }
                #endregion

                #region ddlSupplierTable

                DataSet projectDst = new DataSet();

                SupplierProcess ddlSupplierView = new SupplierProcess(projectDst);

                ddlSupplierView.RealSupplierView();
                DataTable ddlSupplierTable = ddlSupplierView.MyDst.Tables["tbl_supplier_company"];

                //DataColumn[] projectKey = new DataColumn[1];
                //projectKey[0] = ddlProjectTable.Columns["projectTagId"];
                //ddlProjectTable.PrimaryKey = projectKey;

                Session["ddlProjectDtS"] = ddlSupplierTable;

                DataRow dr = ddlSupplierTable.NewRow();
                dr["supplierId"]   = -1;
                dr["supplierName"] = string.Empty;
                dr["endTime"]      = "9999-12-31";
                ddlSupplierTable.Rows.Add(dr);

                ddlSupplier.DataValueField = "supplierId";
                ddlSupplier.DataTextField  = "supplierName";
                ddlSupplier.DataSource     = ddlSupplierTable;
                ddlSupplier.DataBind();
                ddlSupplier.SelectedValue = subContractTable.Rows[0]["supplierId"].ToString();;
                #endregion
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!(null == Session["totleAuthority"]))
            {
                AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"];

                bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.newContract);
                if (!flag)
                {
                    Response.Redirect("~/Main/NoAuthority.aspx");
                }
            }
            else
            {
                string url = Request.FilePath;
                Session["backUrl"] = url;
                Response.Redirect("~/Account/Login.aspx");
            }

            if (!IsPostBack)
            {
                int   subContractId = int.Parse(Session["seldSubContractId"] as string);
                Xm_db xmDataCont    = Xm_db.GetInstance();

                var subContractEdit =
                    (from subContract in xmDataCont.Tbl_subContract
                     where subContract.MainContractId == subContractId &&
                     subContract.EndTime > DateTime.Now
                     select subContract).First();

                txtSubContractTag.Text = subContractEdit.SubContractTag;
                txtMoney.Text          = subContractEdit.Cash.ToString();
                btnDate.Text           = subContractEdit.DateLine.ToString();
                txtPayment.Text        = subContractEdit.PaymentMode;

                #region subProductGV

                var subProductSelDs =
                    from subContrctProduct in subContractEdit.Tbl_subContrctProduct
                    join product in xmDataCont.Tbl_product on
                    subContrctProduct.ProductId equals product.ProductId
                    select new { product.ProductName, subContrctProduct.ProductNum };

                DataTable dt = subProductSelDs.ToDataTable();

                if (dt.Rows.Count > 0)
                {
                    subProductGV.DataSource = dt;
                    subProductGV.DataBind();
                }
                #endregion

                #region ddlSupplierTable

                DataSet projectDst = new DataSet();

                SupplierProcess ddlSupplierView = new SupplierProcess(projectDst);

                ddlSupplierView.RealSupplierView();
                DataTable ddlSupplierTable = ddlSupplierView.MyDst.Tables["tbl_supplier_company"];

                Session["ddlProjectDtS"] = ddlSupplierTable;

                DataRow dr = ddlSupplierTable.NewRow();
                dr["supplierId"]   = -1;
                dr["supplierName"] = string.Empty;
                dr["endTime"]      = "9999-12-31";
                ddlSupplierTable.Rows.Add(dr);

                ddlSupplier.DataValueField = "supplierId";
                ddlSupplier.DataTextField  = "supplierName";
                ddlSupplier.DataSource     = ddlSupplierTable;
                ddlSupplier.DataBind();
                ddlSupplier.SelectedValue = subContractEdit.SupplierId.ToString();
                #endregion
            }
        }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            int index = supplierGV.SelectedIndex;

            int       dataIndex = supplierGV.Rows[index].DataItemIndex;
            DataTable dt        = (DataTable)Session["dtSources"];

            GridViewRow row             = supplierGV.Rows[index];
            TextBox     tbSupplierName  = row.Cells[1].Controls[0] as TextBox;
            string      newSupplierName = tbSupplierName.Text.ToString().Trim();
            TextBox     tbSupplierAddr  = row.Cells[2].Controls[0] as TextBox;
            string      newSupplierAddr = tbSupplierAddr.Text.ToString().Trim();

            DataTable dtCheckTemp = (Session["dtSources"] as DataTable).DefaultView.ToTable();

            string supplierIdTemp = dt.DefaultView[dataIndex].Row["supplierId"].ToString();
            string strFilter      =
                " supplierId <> " + "'" + supplierIdTemp + "'";

            dtCheckTemp.DefaultView.RowFilter = strFilter;
            DataTable dtCheck = dtCheckTemp.DefaultView.ToTable();

            string strNameCheck = newSupplierName;
            string strAddrCheck = newSupplierAddr;

            newSupplierName = input_check("custCompName", strNameCheck, dtCheck);
            newSupplierAddr = input_check("custCompAddress", strAddrCheck, dtCheck);

            if (newSupplierName.Equals(strNameCheck) && newSupplierAddr.Equals(strAddrCheck))
            {
                int supplierId = int.Parse(dt.DefaultView[dataIndex].Row["supplierId"].ToString());

                SupplierProcess sp = Session["SupplierProcess"] as SupplierProcess;

                sp.SupplierUpdate(supplierId, newSupplierName, newSupplierAddr);

                sp.RealSupplierView();

                DataTable taskTable = sp.MyDst.Tables["tbl_supplier_company"];
                Session["dtSources"] = sp.MyDst.Tables["tbl_supplier_company"] as DataTable;

                //Button btn = null;
                //btn = (custCompGV.Rows[index].FindControl("btnDel") as Button);
                //btn.Visible = false;
                //btn = (custCompGV.Rows[index].FindControl("btnCancle") as Button);
                //btn.Visible = false;
                //btn = sender as Button;
                //btn.Visible = false;

                Button btn = null;
                btn         = sender as Button;
                btn.Visible = false;
                btn         = (supplierGV.SelectedRow.FindControl("btnCancle") as Button);
                btn.Visible = false;
                btn         = (supplierGV.SelectedRow.FindControl("btnSupplierManEdit") as Button);
                btn.Visible = false;
                btn         = (supplierGV.SelectedRow.FindControl("btnDel") as Button);
                btn.Visible = false;
                btn         = btnDelCancel;
                btn.Visible = false;
                btn         = btnAcceptDel;
                btn.Visible = false;

                supplierGV.SelectedIndex = -1;
                supplierGV.EditIndex     = -1;

                supplierGV.DataSource = Session["dtSources"];//["dtSources"] as DataTable;
                supplierGV.DataBind();

                btnAdd.Visible = true;
            }
            else
            {
                tbSupplierName.Text = newSupplierName;
                tbSupplierAddr.Text = newSupplierAddr;

                supplierGV.SelectedIndex = index;
                supplierGV.EditIndex     = index;
            }
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!(null == Session["totleAuthority"]))
            {
                AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"];

                bool flag = usrAuthAttr.HasOneFlag(AuthAttributes.stockManager);
                if (!flag)
                {
                    Response.Redirect("~/Main/NoAuthority.aspx");
                }
            }
            else
            {
                string url = Request.FilePath;
                Session["backUrl"] = url;
                Response.Redirect("~/Account/Login.aspx");
            }

            if (!IsPostBack)
            {
                DataSet MyDst = new DataSet();
                #region ddlProduct

                ProductProcess productView = new ProductProcess(MyDst);

                productView.RealProductView();
                DataTable ddlProductTable = productView.MyDst.Tables["tbl_product"].DefaultView.ToTable();

                DataRow ddlProductDr = ddlProductTable.NewRow();
                ddlProductDr["productName"] = string.Empty;
                ddlProductDr["productId"]   = -1;
                ddlProductTable.Rows.Add(ddlProductDr);

                ddlProduct.DataSource     = ddlProductTable;
                ddlProduct.DataTextField  = "productName";
                ddlProduct.DataValueField = "productId";
                ddlProduct.DataBind();
                ddlProduct.SelectedValue = "-1";

                #endregion

                #region ddlEngineer

                UsrAuthProcess usrAuthView = new UsrAuthProcess(MyDst);

                usrAuthView.View();
                DataTable ddlEngineerTable = usrAuthView.MyDst.Tables["view_usr_autority"].DefaultView.ToTable();

                string  authorityName = "货物检验";
                DataRow ddlEngigeerDr = ddlEngineerTable.NewRow();
                ddlEngigeerDr["realName"]      = string.Empty;
                ddlEngigeerDr["usrId"]         = -1;
                ddlEngigeerDr["authorityName"] = authorityName;
                ddlEngineerTable.Rows.Add(ddlEngigeerDr);

                string strFilter =
                    " authorityName = " + "'" + authorityName + "'";
                ddlEngineerTable.DefaultView.RowFilter = strFilter;

                ddlEngineer.DataSource     = ddlEngineerTable;
                ddlEngineer.DataTextField  = "realName";
                ddlEngineer.DataValueField = "usrId";
                ddlEngineer.DataBind();
                ddlEngineer.SelectedValue = "-1";

                #endregion

                #region ddlSupplier

                SupplierProcess supplierView = new SupplierProcess(MyDst);

                supplierView.RealSupplierView();
                DataTable ddlSupplierTable = supplierView.MyDst.Tables["tbl_supplier_company"].DefaultView.ToTable();

                DataRow ddlSupplierDr = ddlSupplierTable.NewRow();
                ddlSupplierDr["supplierName"] = string.Empty;
                ddlSupplierDr["supplierId"]   = -1;
                ddlSupplierTable.Rows.Add(ddlSupplierDr);

                ddlSupplier.DataSource     = ddlSupplierTable;
                ddlSupplier.DataTextField  = "supplierName";
                ddlSupplier.DataValueField = "supplierId";
                ddlSupplier.DataBind();
                ddlSupplier.SelectedValue = "-1";

                #endregion
            }
        }