コード例 #1
0
        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();
                custCompProcess myView = new custCompProcess(MyDst);

                myView.RealCompView();
                DataTable taskTable = myView.MyDst.Tables["tbl_customer_company"];

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


                custCompGV.DataSource = Session["dtSources"];
                custCompGV.DataBind();
            }
        }
コード例 #2
0
ファイル: newBorrow.aspx.cs プロジェクト: max-gui/babymission
        protected void outBorrowInit()
        {
            DataSet MyDst = new DataSet();

            custCompProcess ddlCustCompView = new custCompProcess(MyDst);
            custManProcess  ddlCustManView  = new custManProcess(MyDst);

            ddlCustManView.CustCompId = "-1".ToString();
            ProjectTagProcess ptView = new ProjectTagProcess(MyDst);

            ddlCustCompView.RealCompView();
            ddlCustManView.RealCustManView();
            DataTable ddlCustCompTable = ddlCustCompView.MyDst.Tables["tbl_customer_company"];
            DataTable ddlCustManTable  = ddlCustManView.MyDst.Tables["tbl_customer_manager"];

            DataColumn[] custCompKey = new DataColumn[1];
            custCompKey[0] = ddlCustCompTable.Columns["custCompyId"];
            ddlCustCompTable.PrimaryKey = custCompKey;
            DataColumn[] custManpKey = new DataColumn[1];
            custManpKey[0]             = ddlCustManTable.Columns["custManId"];
            ddlCustManTable.PrimaryKey = custManpKey;

            Session["custCompProcess"]   = ddlCustCompView;
            Session["ddlCustCompDtS"]    = ddlCustCompTable;
            Session["custManProcess"]    = ddlCustManView;
            Session["ddlCustManDtS"]     = ddlCustManTable;
            Session["ProjectTagProcess"] = ptView;

            DataRow dr = ddlCustCompTable.NewRow();

            dr["custCompyId"]  = -1;
            dr["custCompName"] = string.Empty;
            dr["endTime"]      = "9999-12-31";
            ddlCustCompTable.Rows.Add(dr);

            ddlCustComp.DataValueField = "custCompyId";
            ddlCustComp.DataTextField  = "custCompName";
            ddlCustComp.DataSource     = ddlCustCompTable;
            ddlCustComp.DataBind();
            ddlCustComp.SelectedValue = "-1";
        }
コード例 #3
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 ddlCustComp

                DataSet dst = new DataSet();

                custCompProcess ddlCustCompView = new custCompProcess(dst);

                ddlCustCompView.RealCompView();
                DataTable ddlCustCompTable = ddlCustCompView.MyDst.Tables["tbl_customer_company"].DefaultView.ToTable();

                DataRow dr = ddlCustCompTable.NewRow();
                dr["custCompyId"]  = -1;
                dr["custCompName"] = string.Empty;
                dr["endTime"]      = "9999-12-31";
                ddlCustCompTable.Rows.Add(dr);

                Session["ddlProjectDtS"] = ddlCustCompTable;

                ddlCustComp.DataValueField = "custCompyId";
                ddlCustComp.DataTextField  = "custCompName";
                ddlCustComp.DataSource     = Session["ddlProjectDtS"];
                ddlCustComp.DataBind();

                #endregion

                int mainContractId = int.Parse(Session["seldMainContractId"] as string);
                //Xm_db xmDataCont = new Xm_db(System.Configuration.ConfigurationManager.ConnectionStrings["xm_dbConnectionString"].ConnectionString);
                Xm_db xmDataCont = Xm_db.GetInstance();

                var mainContractEdit =
                    (from mainContract in xmDataCont.Tbl_mainContract
                     where mainContract.MainContractId == mainContractId &&
                     mainContract.EndTime > DateTime.Now
                     select mainContract).First();

                ddlCustComp.SelectedValue = mainContractEdit.CustCompyId.ToString();
                txtMainContractTag.Text   = mainContractEdit.MainContractTag;
                txtMoney.Text             = mainContractEdit.Cash.ToString();
                btnDate.Text     = mainContractEdit.DateLine.ToString();
                txtPayment.Text  = mainContractEdit.PaymentMode;
                txtProjAddr.Text = mainContractEdit.Tbl_projectTagInfo.ProjectOutAddress;

                #region mainProductGV

                var mainProductSelDs =
                    from mainProduct in mainContractEdit.Tbl_mainContrctProduct
                    join product in xmDataCont.Tbl_product on
                    mainProduct.ProductId equals product.ProductId
                    select new { product.ProductName, mainProduct.ProductNum };

                DataTable dt = mainProductSelDs.ToDataTable();

                if (dt.Rows.Count > 0)
                {
                    mainProductGV.DataSource = dt;
                    mainProductGV.DataBind();
                }
                #endregion
            }
        }
コード例 #4
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            if (inputCheck())
            {
                string cn = txtCompName.Text.ToString().Trim();
                string ca = txtCompAddr.Text.ToString().Trim();
                string ct = txtCompTag.Text.ToString().Trim();

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

                DataColumn colCompName = new DataColumn("custCompName", System.Type.GetType("System.String"));
                DataColumn colCompAddr = new DataColumn("custCompAddress", System.Type.GetType("System.String"));
                DataColumn colCompTag  = new DataColumn("custCompTag", System.Type.GetType("System.String"));

                DataTable compTable = new DataTable("tbl_customer_company");

                compTable.Columns.Add(colCompName);
                compTable.Columns.Add(colCompAddr);
                compTable.Columns.Add(colCompTag);

                compRow = compTable.NewRow();
                compRow["custCompName"]    = cn;
                compRow["custCompAddress"] = ca;
                compRow["custCompTag"]     = ct;
                compTable.Rows.Add(compRow);

                dataSet.Tables.Add(compTable);
                #endregion

                DataSet         dsCheck = new DataSet();
                custCompProcess ccp     = new custCompProcess(dsCheck);

                ccp.RealCompView();
                int rowRtn = -1;

                ccp.DoCheckCompName(cn);
                rowRtn = ccp.IntRtn;
                if (0 == rowRtn)
                {
                    ccp.DoCheckCompTag(ct);
                    rowRtn = ccp.IntRtn;

                    if (0 == rowRtn)
                    {
                        ccp.MyDst = dataSet;

                        ccp.Add();

                        string newCompId = ccp.StrRtn;

                        Response.Redirect("~/Main/custInfoManager/custCompManager/custCompEdit.aspx");
                    }
                    else
                    {
                        lblCompTag.Text = "公司简称已存在!";
                    }
                }
                else
                {
                    lblCompName.Text = "公司名已存在!";
                }
            }
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!(null == Session["totleAuthority"]))
            {
                AuthAttributes usrAuthAttr = (AuthAttributes)Session["totleAuthority"];

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

            if (!IsPostBack)
            {
                DataSet custCompDst = new DataSet();
                DataSet custManDst  = new DataSet();
                DataSet projTagDst  = new DataSet();

                custCompProcess ddlCustCompView = new custCompProcess(custCompDst);
                custManProcess  ddlCustManView  = new custManProcess(custManDst);
                ddlCustManView.CustCompId = "-1".ToString();
                ProjectTagProcess ptView = new ProjectTagProcess(projTagDst);

                ddlCustCompView.RealCompView();
                ddlCustManView.RealCustManView();
                DataTable ddlCustCompTable = ddlCustCompView.MyDst.Tables["tbl_customer_company"];
                DataTable ddlCustManTable  = ddlCustManView.MyDst.Tables["tbl_customer_manager"];

                DataColumn[] custCompKey = new DataColumn[1];
                custCompKey[0] = ddlCustCompTable.Columns["custCompyId"];
                ddlCustCompTable.PrimaryKey = custCompKey;
                DataColumn[] custManpKey = new DataColumn[1];
                custManpKey[0]             = ddlCustManTable.Columns["custManId"];
                ddlCustManTable.PrimaryKey = custManpKey;

                Session["custCompProcess"]   = ddlCustCompView;
                Session["ddlCustCompDtS"]    = ddlCustCompTable;
                Session["custManProcess"]    = ddlCustManView;
                Session["ddlCustManDtS"]     = ddlCustManTable;
                Session["ProjectTagProcess"] = ptView;

                DataRow dr = ddlCustCompTable.NewRow();
                dr["custCompyId"]  = -1;
                dr["custCompName"] = string.Empty;
                dr["endTime"]      = "9999-12-31";
                ddlCustCompTable.Rows.Add(dr);
                //ddlCustCompTable.AcceptChanges();

                ddlCustComp.DataValueField = "custCompyId";
                ddlCustComp.DataTextField  = "custCompName";
                ddlCustComp.DataSource     = ddlCustCompTable;
                ddlCustComp.DataBind();
                ddlCustComp.SelectedValue = "-1";
            }
        }
コード例 #6
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            int index = custCompGV.SelectedIndex;

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

            GridViewRow row         = custCompGV.Rows[index];
            TextBox     tbCompName  = row.Cells[1].Controls[0] as TextBox;
            string      newCompName = tbCompName.Text.ToString().Trim();
            TextBox     tbCompAddr  = row.Cells[2].Controls[0] as TextBox;
            string      newCompAddr = tbCompAddr.Text.ToString().Trim();
            TextBox     tbCompTag   = row.Cells[3].Controls[0] as TextBox;
            string      newCompTag  = tbCompTag.Text.ToString().Trim();

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

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

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

            string strNameCheck = newCompName;
            string strAddrCheck = newCompAddr;
            string strTagCheck  = newCompTag;

            newCompName = input_check("custCompName", strNameCheck, dtCheck);
            newCompAddr = input_check("custCompAddress", strAddrCheck, dtCheck);
            newCompTag  = input_check("custCompTag", strTagCheck, dtCheck);

            if (newCompName.Equals(strNameCheck) && newCompAddr.Equals(strAddrCheck) && newCompTag.Equals(strTagCheck))
            {
                int custCompId = int.Parse(dt.DefaultView[dataIndex].Row["custCompyId"].ToString());

                custCompProcess ccp = Session["custCompProcess"] as custCompProcess;

                ccp.custCompUpdate(custCompId, newCompName, newCompAddr, newCompTag);

                ccp.RealCompView();

                DataTable taskTable = ccp.MyDst.Tables["tbl_customer_company"];
                Session["dtSources"] = ccp.MyDst.Tables["tbl_customer_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         = (custCompGV.SelectedRow.FindControl("btnCancle") as Button);
                btn.Visible = false;
                btn         = (custCompGV.SelectedRow.FindControl("btnCustManEdit") as Button);
                btn.Visible = false;
                btn         = (custCompGV.SelectedRow.FindControl("btnDel") as Button);
                btn.Visible = false;
                btn         = btnDelCancel;
                btn.Visible = false;
                btn         = btnAcceptDel;
                btn.Visible = false;

                custCompGV.SelectedIndex = -1;
                custCompGV.EditIndex     = -1;

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

                btnAdd.Visible = true;
            }
            else
            {
                tbCompName.Text = newCompName;
                tbCompAddr.Text = newCompAddr;
                tbCompTag.Text  = newCompTag;

                custCompGV.SelectedIndex = index;
                custCompGV.EditIndex     = index;
            }
        }
コード例 #7
0
        protected void btnAcceptDel_Click(object sender, EventArgs e)
        {
            int       dataIndex = custCompGV.SelectedRow.DataItemIndex;
            DataTable dt        = (DataTable)Session["dtSources"];
            string    depId     = dt.DefaultView[dataIndex].Row["custCompyId"].ToString();

            Button btn = null;

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

            custCompProcess ccp = Session["custCompProcess"] as custCompProcess;

            ccp.SelfCustCompDel(depId);

            ccp.RealCompView();

            DataTable taskTable = ccp.MyDst.Tables["tbl_customer_company"];

            Session["dtSources"]  = ccp.MyDst.Tables["tbl_customer_company"] as DataTable;
            custCompGV.DataSource = Session["dtSources"];

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

            custCompGV.Enabled = true;
            btnAdd.Visible     = true;

            //int index = custCompGV.SelectedIndex;
            //int itemIdex = custCompGV.Rows[index].DataItemIndex;

            //DataTable dt = (Session["upDtSources"] as DataTable).DefaultView.ToTable();
            //string usrId = dt.Rows[itemIdex]["usrId"].ToString();

            //UserProcess up = Session["UserProcess"] as UserProcess;

            //up.usrDel(usrId);

            //up.UsrSelfDepartTitleView();
            //DataTable upTable = up.MyDst.Tables["view_usr_department_title"];
            //Session["upDtSources"] = upTable;

            //custCompGV.DataSource = Session["upDtSources"];
            //custCompGV.DataBind();

            //Button btn = sender as Button;
            //btn.Visible = false;
            //btn = btnDelCancel;
            //btn.Visible = false;
            //btn = btnAdd;
            //btn.Visible = true;

            //custCompGV.SelectedIndex = -1;
            //custCompGV.Enabled = true;
        }
コード例 #8
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 ddlCustComp

                DataSet dst = new DataSet();

                custCompProcess ddlCustCompView = new custCompProcess(dst);

                ddlCustCompView.RealCompView();
                DataTable ddlCustCompTable = ddlCustCompView.MyDst.Tables["tbl_customer_company"].DefaultView.ToTable();

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



                DataRow dr = ddlCustCompTable.NewRow();
                dr["custCompyId"]  = -1;
                dr["custCompName"] = string.Empty;
                dr["endTime"]      = "9999-12-31";
                ddlCustCompTable.Rows.Add(dr);

                Session["ddlProjectDtS"] = ddlCustCompTable;

                ddlCustComp.DataValueField = "custCompyId";
                ddlCustComp.DataTextField  = "custCompName";
                ddlCustComp.DataSource     = Session["ddlProjectDtS"];
                ddlCustComp.DataBind();

                #endregion

                #region mainContractTable
                DataTable mainContractTable = null;
                if (null == Session["mainContractTable"])
                {
                    DataRow mainContractRow = null;

                    DataColumn colProjectTagId    = new DataColumn("projectTagId", System.Type.GetType("System.String"));
                    DataColumn colCustCompId      = new DataColumn("custCompyId", System.Type.GetType("System.String"));
                    DataColumn colMainContractTag = new DataColumn("mainContractTag", 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"));

                    mainContractTable = new DataTable("tbl_mainContract");

                    mainContractTable.Columns.Add(colProjectTagId);
                    mainContractTable.Columns.Add(colCustCompId);
                    mainContractTable.Columns.Add(colMainContractTag);
                    mainContractTable.Columns.Add(colCash);
                    mainContractTable.Columns.Add(colDateLine);
                    mainContractTable.Columns.Add(colPaymentMode);

                    mainContractRow = mainContractTable.NewRow();
                    mainContractRow["projectTagId"]    = -1;
                    mainContractRow["custCompyId"]     = -1;
                    mainContractRow["mainContractTag"] = string.Empty;
                    mainContractRow["cash"]            = string.Empty;
                    mainContractRow["dateLine"]        = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff");
                    mainContractRow["paymentMode"]     = string.Empty;
                    mainContractTable.Rows.Add(mainContractRow);

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

                ddlCustComp.SelectedValue = mainContractTable.Rows[0]["custCompyId"].ToString();
                txtMainContractTag.Text   = mainContractTable.Rows[0]["mainContractTag"].ToString();
                txtMoney.Text             = mainContractTable.Rows[0]["cash"].ToString();
                btnDate.Text    = mainContractTable.Rows[0]["dateLine"].ToString();
                txtPayment.Text = mainContractTable.Rows[0]["paymentMode"].ToString();
                #endregion

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

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

                #region ddlProjectTable
                string usrId = Session["usrId"] as string;

                ProjectTagProcess ddlProjectView = new ProjectTagProcess(dst);

                ddlProjectView.RealProjTagView(usrId);
                DataTable ddlProjectTable = ddlProjectView.MyDst.Tables["projectTag_view"].DefaultView.ToTable();

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

                Session["ddlProjectDtS"] = ddlProjectTable;

                dr = ddlProjectTable.NewRow();
                dr["projectTagId"]   = -1;
                dr["projectTag"]     = string.Empty;
                dr["endTime"]        = "9999-12-31";
                dr["applymentUsrId"] = usrId;
                dr["custCompyId"]    = -1;
                ddlProjectTable.Rows.Add(dr);

                ddlProjectTag.DataValueField = "projectTagId";
                ddlProjectTag.DataTextField  = "projectTag";
                ddlProjectTag.DataSource     = ddlProjectTable;
                ddlProjectTag.DataBind();
                ddlProjectTag.SelectedValue = mainContractTable.Rows[0]["projectTagId"].ToString();;
                #endregion
            }
        }