Пример #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 (null == Session["selCustCompDr"])
            {
                Response.Redirect("~/Main/custInfoManager/custCompManager/custCompEdit.aspx");
            }

            if (!IsPostBack)
            {
                DataRow sessionDr = Session["selCustCompDr"] as DataRow;

                lblCustCompName.Text = sessionDr["custCompName"].ToString();
                lblCustCompAddr.Text = sessionDr["custCompAddress"].ToString();
                lblCustCompTag.Text  = sessionDr["custCompTag"].ToString();

                string custCompId = sessionDr["custCompyId"].ToString();

                DataSet        MyDst  = new DataSet();
                custManProcess myView = new custManProcess(MyDst);
                myView.CustCompId = custCompId;

                myView.RealCustManView();
                DataTable taskTable = myView.MyDst.Tables["tbl_customer_manager"];

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


                custCompManGV.DataSource = Session["dtSources"];
                custCompManGV.DataBind();
            }
        }
Пример #2
0
        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 btnAcceptDel_Click(object sender, EventArgs e)
        {
            int       dataIndex = custCompManGV.SelectedRow.DataItemIndex;
            DataTable dt        = (DataTable)Session["dtSources"];
            string    manId     = dt.DefaultView[dataIndex].Row["custManId"].ToString();

            Button btn = null;

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

            custManProcess cmp = Session["custManProcess"] as custManProcess;

            cmp.CustCompManDel(manId);

            cmp.RealCustManView();

            DataTable taskTable = cmp.MyDst.Tables["tbl_customer_manager"];

            Session["dtSources"]     = cmp.MyDst.Tables["tbl_customer_manager"] as DataTable;
            custCompManGV.DataSource = Session["dtSources"];

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

            custCompManGV.Enabled = true;
            btnAdd.Visible        = true;
        }
Пример #4
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            int index = custCompManGV.SelectedIndex;

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

            GridViewRow row             = custCompManGV.Rows[index];
            TextBox     tbCompManName   = row.Cells[1].Controls[0] as TextBox;
            string      newCompManName  = tbCompManName.Text.ToString().Trim();
            TextBox     tbCompManCont   = row.Cells[2].Controls[0] as TextBox;
            string      newCompManCont  = tbCompManCont.Text.ToString().Trim();
            TextBox     tbCompManEmail  = row.Cells[3].Controls[0] as TextBox;
            string      newCompManEmail = tbCompManEmail.Text.ToString().Trim();
            TextBox     tbCompManDep    = row.Cells[4].Controls[0] as TextBox;
            string      newCompManDep   = tbCompManDep.Text.ToString().Trim();
            TextBox     tbCompManTitle  = row.Cells[5].Controls[0] as TextBox;
            string      newCompManTitle = tbCompManTitle.Text.ToString().Trim();

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

            //string strFilter =
            //    " custCompTag = " + "'" + tbCompManName + "'";
            //dtCheckTemp.DefaultView.RowFilter = strFilter;
            //DataTable dtCheck = dtCheckTemp.DefaultView.ToTable();

            string strNameCheck  = newCompManName;
            string strContCheck  = newCompManCont;
            string strEmailCheck = newCompManEmail;
            string strDepCheck   = newCompManDep;
            string strTitleCheck = newCompManTitle;

            newCompManName  = input_check(strNameCheck);//, dtCheck);
            newCompManCont  = input_check(strContCheck);
            newCompManEmail = input_check(strEmailCheck);
            newCompManDep   = input_check(strDepCheck);
            newCompManTitle = input_check(strTitleCheck);

            bool checkFlag = true;

            checkFlag = checkFlag && newCompManName.Equals(strNameCheck);
            checkFlag = checkFlag && newCompManCont.Equals(strContCheck);
            checkFlag = checkFlag && newCompManEmail.Equals(strEmailCheck);
            checkFlag = checkFlag && newCompManDep.Equals(strDepCheck);
            checkFlag = checkFlag && newCompManTitle.Equals(strTitleCheck);

            if (true == checkFlag)
            {
                int custManId = int.Parse(dt.DefaultView[dataIndex].Row["custManId"].ToString());

                custManProcess cmp = Session["custManProcess"] as custManProcess;

                cmp.custCompManUpdate(custManId, newCompManName, newCompManCont, newCompManEmail, newCompManDep, newCompManTitle);

                cmp.RealCustManView();

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

                custCompManGV.SelectedIndex = -1;
                custCompManGV.EditIndex     = -1;

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

                btnAdd.Visible = true;
            }
            else
            {
                tbCompManName.Text  = newCompManName;
                tbCompManCont.Text  = newCompManCont;
                tbCompManEmail.Text = newCompManEmail;
                tbCompManDep.Text   = newCompManDep;
                tbCompManTitle.Text = newCompManTitle;

                custCompManGV.SelectedIndex = index;
                custCompManGV.EditIndex     = index;
            }
        }
Пример #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";
            }
        }