private OrderItem GetOrderItem(GridViewRow row)
 {
     var qtyLabel = row.FindControl("Quantity") as Label;
     var nameLabel = row.FindControl("ItemName") as Label;
     var priceLabel = row.FindControl("Price") as Label;
     var result = new OrderItem()
     {
         Quantity = int.Parse(qtyLabel.Text),
         ItemName = nameLabel.Text,
         Price = decimal.Parse(priceLabel.Text)
     };
     return result;
 }
    private CategoryProduct GetProductByCategory(GridViewRow row)
    {
        var cateDesLabel = row.FindControl("ProductCategoryDes_LB") as Label;
        var productDesLabel = row.FindControl("ProductDes_LB") as Label;
        var priceLabel = row.FindControl("SellingPrice_LB") as Label;
        var qohLabel = row.FindControl("QOH_LB") as Label;
        var result = new CategoryProduct()
        {
            ProdcutCategoryDes = cateDesLabel.Text,
            ProductDes = productDesLabel.Text,
            SellingPrice = Decimal.Parse(priceLabel.Text.ToString()),
            QOH = int.Parse(qohLabel.Text.ToString())

        };
        return result;
    }
    protected bool IsRowModified(GridViewRow r)
    {
        int currentID;
        Boolean cbVerificado;

        currentID = Convert.ToInt32(GridView1.DataKeys[0].Value);

        cbVerificado = ((CheckBox)r.FindControl("CheckBox1")).Checked;
        DataRow row =
            originalDataTable.Select(String.Format("id = {0}", currentID))[0];

         if (!cbVerificado.Equals(row["Estado"].ToString()))
        {
            return true;
        }
        return false;
    }
示例#4
0
        protected void gvHTpop_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         index        = 0;
            GridViewRow gvr          = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         CurrentIndex = gvr.RowIndex;

            if (e.CommandName.Equals("View"))
            {
                IndexChangeBiz biz = new IndexChangeBiz();
                //GridViewRow gr = (GridViewRow)((LinkButton)sender).NamingContainer;
                var lblHEAD_REQUEST_NO = (Label)gvr.FindControl("lblHEAD_REQUEST_NO");
                DTO.ResponseService <DTO.SubPaymentDetail[]> ls = biz.GetIndexSubPaymentD(lblHEAD_REQUEST_NO.Text.Trim());

                //Test HEAD_REQUEST_NO='131029133903341';
                //DTO.ResponseService<DTO.SubPaymentDetail[]> ls = biz.GetIndexSubPaymentD("131029133903341");
                if (ls.DataResponse != null)
                {
                    this.CurrentSessionListDT = ls.DataResponse.ToList();
                    gvDTpop.DataSource        = ls.DataResponse;
                    gvDTpop.DataBind();
                    modalMain.Show();
                    modalMain2.Show();
                }
            }
            else
            {
                if (e.CommandName == "Up")
                {
                    int rowcount = this.gvHTpop.Rows.Count;
                    for (int i = 0; i < rowcount; i++)
                    {
                        index++;
                    }

                    //Get Row Index
                    int RowIndex = int.Parse(e.CommandArgument.ToString());
                    if (RowIndex < 1)
                    {
                        this.ucError.ShowMessageError = "Can't moveup";
                        this.ucError.ShowModalError();
                        this.modalMain.Show();
                        return;
                    }
                }
                else
                {
                    int rowcount = this.gvHTpop.Rows.Count;
                    for (int i = 0; i < rowcount; i++)
                    {
                        index++;
                    }

                    //Get Row Index
                    int RowIndex = int.Parse(e.CommandArgument.ToString());
                    RowIndex = RowIndex + 1;
                    if (RowIndex >= index)
                    {
                        this.ucError.ShowMessageError = "Can't movedown";
                        this.ucError.ShowModalError();
                        this.modalMain.Show();
                        return;
                    }
                }

                List <DTO.SubPaymentHead> newls = this.SortDescriptionsHT(this.CurrentSessionListHT, CurrentIndex, e.CommandName);

                //Rebind
                this.gvHTpop.DataSource = newls;
                this.gvHTpop.DataBind();

                this.gvHT.DataSource = newls;
                this.gvHT.DataBind();

                udpMain.Update();
                modalMain.Show();
            }

            //if (e.CommandName == "Up")
            //{
            //    int index = 0;
            //    GridViewRow gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            //    int CurrentIndex = gvr.RowIndex;

            //    int rowcount = this.gvHTpop.Rows.Count;
            //    for (int i = 0; i < rowcount; i++)
            //    {
            //        index++;
            //    }

            //    //Get Row Index
            //    int RowIndex = int.Parse(e.CommandArgument.ToString());
            //    if (RowIndex < 1)
            //    {
            //        this.ucError.ShowMessageError = "Can't moveup";
            //        this.ucError.ShowModalError();
            //        this.modalMain.Show();
            //        return;
            //    }

            //    this.SortDescriptions(this.CurrentSessionList, CurrentIndex, e.CommandName);

            //    //Get Current & Previous Data
            //    DTO.SubPaymentHead cur = this.CurrentSessionList[CurrentIndex];
            //    DTO.SubPaymentHead pre = this.CurrentSessionList[CurrentIndex - 1];

            //    int order = Convert.ToInt32(cur.SEQ_OF_GROUP);
            //    cur.SEQ_OF_GROUP = pre.SEQ_OF_GROUP;
            //    pre.SEQ_OF_GROUP = Convert.ToString(order);


            //    //Resort
            //    this.CurrentSessionList[CurrentIndex] = pre;
            //    this.CurrentSessionList[CurrentIndex - 1] = cur;

            //    //Rebind
            //    this.gvHTpop.DataSource = this.CurrentSessionList.OrderBy(idx => idx.SEQ_OF_GROUP).ToList();
            //    this.gvHTpop.DataBind();

            //    this.gvHT.DataSource = this.CurrentSessionList.OrderBy(idx => idx.SEQ_OF_GROUP).ToList();
            //    this.gvHT.DataBind();

            //    udpMain.Update();
            //    modalMain.Show();
            //}
            //else if (e.CommandName == "Down")
            //{
            //    int index = 0;
            //    GridViewRow gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            //    int CurrentIndex = gvr.RowIndex;

            //    int rowcount = this.gvHTpop.Rows.Count;
            //    for (int i = 0; i < rowcount; i++)
            //    {
            //        index++;
            //    }

            //    //Get Row Index
            //    int RowIndex = int.Parse(e.CommandArgument.ToString());
            //    RowIndex = RowIndex + 1;
            //    if (RowIndex >= index)
            //    {
            //        this.ucError.ShowMessageError = "Can't movedown";
            //        this.ucError.ShowModalError();
            //        this.modalMain.Show();
            //        return;
            //    }

            //    //Get Current & Next Data
            //    DTO.SubPaymentHead cur = this.CurrentSessionList[CurrentIndex];
            //    DTO.SubPaymentHead next = this.CurrentSessionList[CurrentIndex + 1];
            //    int order = Convert.ToInt32(cur.SEQ_OF_GROUP);
            //    cur.SEQ_OF_GROUP = next.SEQ_OF_GROUP;
            //    next.SEQ_OF_GROUP = Convert.ToString(order);

            //    //Resort
            //    this.CurrentSessionList[CurrentIndex] = next;
            //    this.CurrentSessionList[CurrentIndex + 1] = cur;

            //    //Rebind
            //    this.gvHTpop.DataSource = this.CurrentSessionList.OrderBy(idx => idx.SEQ_OF_GROUP).ToList();
            //    this.gvHTpop.DataBind();

            //    this.gvHT.DataSource = this.CurrentSessionList.OrderBy(idx => idx.SEQ_OF_GROUP).ToList();
            //    this.gvHT.DataBind();

            //    udpMain.Update();
            //    modalMain.Show();
            //}
            //else if (e.CommandName == "View")
            //{
            //    GridViewRow gr = (GridViewRow)((LinkButton)sender).NamingContainer;
            //    var lblHEAD_REQUEST_NO = (Label)gr.FindControl("lblHEAD_REQUEST_NO");

            //}
        }
示例#5
0
 public void SetInputControlsActivityType(GridViewRow gridViewRowData)
 {
     TextBoxActivityTypeName = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxActivityTypeName"));
 }
示例#6
0
 protected void lnkView_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton  btnButton = sender as LinkButton;
         GridViewRow gvRow     = (GridViewRow)btnButton.NamingContainer;
         System.Web.UI.WebControls.Label lblTitle = (System.Web.UI.WebControls.Label)gvRow.FindControl("gd_1");
         string    lblid1    = lblTitle.Text;
         DataTable ddokdicno = new DataTable();
         ddokdicno = DBCon.Ora_Execute_table("select * from jpa_extension where ext_applcn_no='" + lblTitle.Text + "' ");
         if (ddokdicno.Rows.Count != 0)
         {
             string name = HttpUtility.UrlEncode(service.Encrypt(lblTitle.Text));
             //Response.Redirect("../kewengan/kw_profil_syarikat.aspx?edit={0}"+ og_genid.Text + "");
             Response.Redirect(string.Format("../Pelaburan_Anggota/PP_MP_Tempoh.aspx?edit={0}", name));
         }
         else
         {
             Session["validate_success"] = "";
             ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Maklumat Carian Tidak Dijumpai.',{'type': 'warning','title': 'warning','auto_close': 2000});", true);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private Visualization_InvVisualBoard_Kanban GetKanbanControl(GridViewRow gvr)
 {
     return (Visualization_InvVisualBoard_Kanban)gvr.FindControl("ucKanban");
 }
 private void BindFieldsToOpportunity(TBL_OPPORTUNITIES opportunity, GridViewRow row)
 {
     opportunity.NAME = (row.FindControl("txtName") as TextBox).Text;
     if (!string.IsNullOrEmpty((row.FindControl("txtValue") as TextBox).Text))
         opportunity.VALUE = decimal.Parse((row.FindControl("txtValue") as TextBox).Text);
     if (!string.IsNullOrEmpty((row.FindControl("txtCloseDt") as TextBox).Text))
         opportunity.CLOSEDATE = Convert.ToDateTime((row.FindControl("txtCloseDt") as TextBox).Text);
     opportunity.SALESREPFIRSTNAME = (row.FindControl("txtSalesFN") as TextBox).Text;
     opportunity.SALESREPLASTNAME = (row.FindControl("txtSalesLN") as TextBox).Text;
     if ((row.FindControl("ddlProductStatus") as DropDownList).SelectedIndex > 0)
         opportunity.STATUSID = int.Parse((row.FindControl("ddlProductStatus") as DropDownList).SelectedValue);
     else
         opportunity.STATUSID = null;
     opportunity.Notes = (row.FindControl("txtNotes") as TextBox).Text;
 }
示例#9
0
        protected void btn_ZY_Click(object sender, EventArgs e)
        {
            string userid = Session["UserID"].ToString();

            if (userid == LabelDocumentid.Text)
            {
                int temp = isselected();
                if (temp == 0)//是否选择数据
                {
                    string sqltext           = "";
                    string ptcode            = "";
                    string marid             = "";
                    string shape             = "";
                    string note              = "";
                    double length            = 0;
                    double width             = 0;
                    double num               = 0;
                    double fznum             = 0;
                    string beizhu            = "";
                    string pjid              = "";
                    string engid             = "";
                    string zypihao           = "";
                    string sql               = "select PR_PJID,PR_ENGID,PUR_MASHAPE,PR_NOTE from TBPC_PCHSPLANRVW where PR_SHEETNO='" + gloabcode + "'";
                    System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sql);
                    if (dt.Rows.Count > 0)
                    {
                        pjid  = dt.Rows[0]["PR_PJID"].ToString();
                        engid = dt.Rows[0]["PR_ENGID"].ToString();
                        shape = dt.Rows[0]["PUR_MASHAPE"].ToString();
                        note  = dt.Rows[0]["PR_NOTE"].ToString();
                    }

                    //查询批号是否存在
                    sql = "select pr_pcode from TBPC_MARSTOUSETOTAL where pr_pcode like '" + gloabcode + "%' order by pr_pcode ASC";
                    dt  = DBCallCommon.GetDTUsingSqlText(sql);
                    if (dt.Rows.Count > 0)
                    {
                        int number = dt.Rows.Count;
                        if (number == 1)
                        {
                            zypihao = gloabcode + "#1";
                        }
                        else
                        {
                            zypihao = gloabcode + "#" + Convert.ToString(Convert.ToDouble(dt.Rows[number - 1][0].ToString().Split('#')[1]) + 1);
                        }
                    }
                    else
                    {
                        zypihao = gloabcode;
                    }
                    globlempcode = zypihao;
                    for (int i = 0; i < GridView1.Rows.Count; i++)
                    {
                        GridViewRow gr = GridView1.Rows[i];
                        System.Web.UI.WebControls.CheckBox cbk = (System.Web.UI.WebControls.CheckBox)gr.FindControl("CheckBox1");
                        if (cbk.Checked)
                        {
                            ptcode  = ptcode = ((System.Web.UI.WebControls.Label)gr.FindControl("PlanCode")).Text;
                            marid   = ((System.Web.UI.WebControls.Label)gr.FindControl("MaterialCode")).Text;
                            length  = Convert.ToDouble(((System.Web.UI.WebControls.Label)gr.FindControl("Length")).Text);
                            width   = Convert.ToDouble(((System.Web.UI.WebControls.Label)gr.FindControl("Width")).Text);
                            num     = Convert.ToDouble(((System.Web.UI.WebControls.Label)gr.FindControl("Number")).Text);
                            fznum   = Convert.ToDouble(((System.Web.UI.WebControls.Label)gr.FindControl("fznum")).Text);
                            beizhu  = ((System.Web.UI.WebControls.TextBox)gr.FindControl("tb_value")).Text;
                            sqltext = "insert into TBPC_MARSTOUSEALL(PUR_PCODE,PUR_PJID,PUR_ENGID,PUR_PTCODE, PUR_MARID, PUR_LENGTH,PUR_WIDTH,PUR_NUM, PUR_FZNUM,PUR_USTNUM,PUR_USTFZNUM,PUR_NOTE) values ('" + zypihao + "','" + pjid + "','" + engid + "','" + ptcode + "','" + marid + "'," + length + "," + width + "," + num + "," + fznum + ",'" + num + "','" + fznum + "','" + beizhu + "')";
                            DBCallCommon.ExeSqlText(sqltext);
                        }
                    }
                    string zdid = Session["UserID"].ToString();
                    string zdtm = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    sqltext = "insert into TBPC_MARSTOUSETOTAL (PR_PCODE,PR_PJID,PR_ENGID,PUR_MASHAPE,PR_NOTE) values ('" + zypihao + "','" + pjid + "','" + engid + "','" + shape + "','" + note + "')";
                    DBCallCommon.ExeSqlText(sqltext);
                    sqltext = "update TBPC_MARSTOUSETOTAL set PR_REVIEWA='" + zdid + "', " +
                              "PR_REVIEWATIME='" + zdtm + "',PR_STATE='1' " +
                              "where  PR_PCODE='" + zypihao + "'";
                    DBCallCommon.ExeSqlText(sqltext);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "openclosemodewin1();", true);
                }
                else if (temp == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您没有选择数据,本次操作无效!');", true);
                }
                else if (temp == 2)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('你选择了已经提交库存占用审核的数据!');", true);
                }
                else if (temp == 3)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('你选择了不是同一批计划的物料!');", true);
                }
                else if (temp == 4)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('选择了未关闭的数据,需要先关闭,再占用!');", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您无权进行操作!');", true);
            }
        }
示例#10
0
    private int CancelInvByChange(GridViewRow grdRow)
    {
        HiddenField hdfINV_NO = (HiddenField)grdRow.FindControl("hdfINV_NO");
        HiddenField hdfUPDATEDATE = (HiddenField)grdRow.FindControl("hdfUPDATEDATE");
        HiddenField hdfUPDATEUID = (HiddenField)grdRow.FindControl("hdfUPDATEUID");
        ASP.wui_slp_slp_slpdate_ascx slp_CANCEL_DATE = (ASP.wui_slp_slp_slpdate_ascx)grdRow.FindControl("slp_CANCEL_DATE");

        CAAModel.ProcessInvoiceChange BCO = new CAAModel.ProcessInvoiceChange(ConntionDB);
        ParameterList.Clear();
        ParameterList.Add(hdfINV_NO.Value);
        ParameterList.Add(slp_CANCEL_DATE.Text);
        ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
        ParameterList.Add(Session["UID"].ToString());
        ParameterList.Add(hdfUPDATEDATE.Value);
        ParameterList.Add(hdfUPDATEUID.Value);
        return BCO.CancelInvByChange(ParameterList, null);
    }
 private TextBox GetItemCodeTextBox(GridViewRow gvr)
 {
     return (TextBox)gvr.FindControl("tbItemCode");
 }
示例#12
0
    protected void BillItems_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        e.Cancel = true;                                  // to prevent any other processing in the GridView's default select handling

        GridView    sendingGridView = sender as GridView; // notice the safe casting
        GridViewRow row             = sendingGridView.Rows[e.NewSelectedIndex];

        // 1) get the info from the row
        var qtyLabel = row.FindControl("Quantity") as Label;
        //                <asp:Label ID="Quantity" ... />
        var       nameLabel  = row.FindControl("ItemName") as Label;
        var       priceLabel = row.FindControl("Price") as Label;
        OrderItem itemToMove = new OrderItem()
        {
            ItemName = nameLabel.Text,
            Quantity = int.Parse(qtyLabel.Text),
            Price    = decimal.Parse(priceLabel.Text)
        };

        // temp output
        MessageLabel.Text = "I want to move " + qtyLabel.Text + " " + nameLabel.Text + " items onto the other bill (GridView) $" + priceLabel.Text + " each";
        // 2) move it to the other gridview
        GridView targetGridView;

        if (sender == OriginalBillItems)
        {
            targetGridView = NewBillItems;
        }
        else
        {
            targetGridView = OriginalBillItems;
        }
        List <OrderItem> targetItems = new List <OrderItem>();

        foreach (GridViewRow targetRow in targetGridView.Rows)
        {
            qtyLabel   = targetRow.FindControl("Quantity") as Label;
            nameLabel  = targetRow.FindControl("ItemName") as Label;
            priceLabel = targetRow.FindControl("Price") as Label;
            targetItems.Add(new OrderItem()
            {
                ItemName = nameLabel.Text,
                Quantity = int.Parse(qtyLabel.Text),
                Price    = decimal.Parse(priceLabel.Text)
            });
        }
        targetItems.Add(itemToMove);
        targetGridView.DataSource = targetItems;
        targetGridView.DataBind();
        // 3) take the row out of this list
        List <OrderItem> senderItems = new List <OrderItem>();

        for (int index = 0; index < sendingGridView.Rows.Count; index++)
        {
            if (index != e.NewSelectedIndex)
            {
                GridViewRow senderRow = sendingGridView.Rows[index];
                qtyLabel   = senderRow.FindControl("Quantity") as Label;
                nameLabel  = senderRow.FindControl("ItemName") as Label;
                priceLabel = senderRow.FindControl("Price") as Label;
                senderItems.Add(new OrderItem()
                {
                    ItemName = nameLabel.Text,
                    Quantity = int.Parse(qtyLabel.Text),
                    Price    = decimal.Parse(priceLabel.Text)
                });
            }
        }
        sendingGridView.DataSource = senderItems;
        sendingGridView.DataBind();
        // 4) happy dance
    }
示例#13
0
 private MRP_ShiftPlan_Import_PreviewDetail GetDetailControl(GridViewRow gvr)
 {
     return (MRP_ShiftPlan_Import_PreviewDetail)gvr.FindControl("ucDetail");
 }
 private Label GetItemCodeLabel(GridViewRow gvr)
 {
     return (Label)gvr.FindControl("lblItemCode");
 }
示例#15
0
 private Hu_TransformerDetail GetTransformerDetailControl(GridViewRow gvr)
 {
     return (Hu_TransformerDetail)gvr.FindControl("ucTransformerDetail");
 }
示例#16
0
    private void UpdateRow(GridViewRow row)
    {
        var d = BonusPlans.GetEditingItems(PlanId).SingleOrDefault(p => p.Id == (Guid)gvItems.DataKeys[row.RowIndex].Value);
        if (d != null)
        {
            string dc = (row.FindControl("txtDealerCode") as TextBox).Text.Trim().ToUpper();
            string am = (row.FindControl("txtAmount") as TextBox).Text;
            string ds = (row.FindControl("txtDesc") as TextBox).Text.Trim();
            string bd = (row.FindControl("txtBonusDate") as TextBox).Text;
            string bs = (row.FindControl("dlBSource") as DropDownList).SelectedValue;
            string st = (row.FindControl("dlStatus") as DropDownList).SelectedValue;

            d.DealerCode = dc;
            d.Amount = long.Parse(am);
            d.Description = ds;
            d.Status = st;
            //d.PlanType = "V";
            d.BonusSourceId = string.IsNullOrEmpty(bs) || bs == "0" ? null : (long?)long.Parse(bs);
            d.BonusDate = DataFormat.DateFromString(bd);
        }
    }
示例#17
0
 private int CHGInvByChange(GridViewRow grdRow)
 {
     CAAModel.ProcessInvoiceChange BCO = new CAAModel.ProcessInvoiceChange(ConntionDB);
     //@發票號碼、@型式、@結帳統編、@品名、@銷售金額、@稅額、@抬頭、@更新日期、@更新人、@原始更新日期、@原始更新人    
     HiddenField hdfINV_NO = (HiddenField)grdRow.FindControl("hdfINV_NO");
     HiddenField hdfUPDATEDATE = (HiddenField)grdRow.FindControl("hdfUPDATEDATE");
     HiddenField hdfUPDATEUID = (HiddenField)grdRow.FindControl("hdfUPDATEUID");
     TextBox txtVOUCH_RFNO = (TextBox)grdRow.FindControl("txtVOUCH_RFNO");
     TextBox txtTITLE = (TextBox)grdRow.FindControl("txtTITLE");
     TextBox txtITEM_NAME = (TextBox)grdRow.FindControl("txtITEM_NAME");
     TextBox txtINV_UAMT = (TextBox)grdRow.FindControl("txtINV_UAMT");
     TextBox txtINV_TAX = (TextBox)grdRow.FindControl("txtINV_TAX");
     TextBox txtINV_AMT = (TextBox)grdRow.FindControl("txtINV_AMT");
     DropDownList slp_INV_FORM = (DropDownList)((ASP.sys_slp_slp_codefile_ascx)grdRow.FindControl("slp_INV_FORM")).FindControl("D1");
     
     ParameterList.Clear();
     ParameterList.Add(hdfINV_NO.Value);
     ParameterList.Add(hdfType.Value);
     ParameterList.Add(txtVOUCH_RFNO.Text);
     ParameterList.Add(slp_INV_FORM.SelectedValue);
     ParameterList.Add(txtTITLE.Text);
     ParameterList.Add(txtITEM_NAME.Text);
     ParameterList.Add(txtINV_UAMT.Text);
     ParameterList.Add(txtINV_TAX.Text);
     ParameterList.Add(txtINV_AMT.Text);
     ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
     ParameterList.Add(Session["UID"].ToString());
     ParameterList.Add(hdfUPDATEDATE.Value);
     ParameterList.Add(hdfUPDATEUID.Value);
     return BCO.CHGInvByChange(ParameterList, null);
 }
示例#18
0
        protected void txtprecio_TextChanged(object sender, EventArgs e)
        {
            GridViewRow currentRow    = (GridViewRow)((TextBox)sender).Parent.Parent;
            DataTable   dtdetalles    = (DataTable)Session["detalles"];
            TextBox     txt           = (TextBox)currentRow.FindControl("txtcantidad");
            TextBox     pre           = (TextBox)currentRow.FindControl("txtprecio");
            TextBox     pes           = (TextBox)currentRow.FindControl("txtpeso");
            TextBox     canpes        = (TextBox)currentRow.FindControl("txtcantidapeso");
            TextBox     unidad        = (TextBox)currentRow.FindControl("txtunidad");
            decimal     precio        = Math.Round(Convert.ToDecimal(pre.Text), 2);
            decimal     peso          = Math.Round(Convert.ToDecimal(pes.Text), 2);
            int         dcantidad     = Convert.ToInt32(txt.Text);
            decimal     cantidadkilos = Math.Round(Convert.ToDecimal(canpes.Text), 2);
            decimal     igv           = Convert.ToDecimal(currentRow.Cells[5].Text);
            int         unidades      = Convert.ToInt32(unidad.Text);
            int         idmedida      = Convert.ToInt32(currentRow.Cells[9].Text);
            int         idpro         = Convert.ToInt32(currentRow.Cells[0].Text);

            if (idpro == 486 || idpro == 488 || idpro == 487 || idpro == 297)
            {
                cantidadkilos = Math.Round(dcantidad * peso, 2);
                decimal subtotal = Math.Round(dcantidad * precio * peso, 2);
                decimal subigv   = Math.Round(subtotal - (subtotal / (1 + igv)), 2);
                dtdetalles.Rows[currentRow.RowIndex]["PrecioUnidad"] = precio;
                dtdetalles.Rows[currentRow.RowIndex]["Cantidad"]     = dcantidad;
                dtdetalles.Rows[currentRow.RowIndex]["SubTotal"]     = subtotal;
                dtdetalles.Rows[currentRow.RowIndex]["Peso"]         = peso;
                dtdetalles.Rows[currentRow.RowIndex]["igvsub"]       = subigv;
                dtdetalles.Rows[currentRow.RowIndex]["Cantidadpeso"] = cantidadkilos;
                dtdetalles.Rows[currentRow.RowIndex]["Unidad"]       = unidades;
            }
            else
            {
                if (precio <= 14.00m)
                {
                    if (igv == 0)
                    {
                        decimal subtotal = Math.Round(dcantidad * precio * peso, 2);
                        decimal subigv   = Math.Round(subtotal - (subtotal / (1 + igv)), 2);
                        dtdetalles.Rows[currentRow.RowIndex]["PrecioUnidad"] = precio;
                        dtdetalles.Rows[currentRow.RowIndex]["Cantidad"]     = dcantidad;
                        dtdetalles.Rows[currentRow.RowIndex]["SubTotal"]     = subtotal;
                        dtdetalles.Rows[currentRow.RowIndex]["Peso"]         = peso;
                        dtdetalles.Rows[currentRow.RowIndex]["igvsub"]       = subigv;
                        dtdetalles.Rows[currentRow.RowIndex]["Cantidadpeso"] = cantidadkilos;
                        dtdetalles.Rows[currentRow.RowIndex]["Unidad"]       = unidades;
                    }
                    else
                    {
                        decimal subtotal = Math.Round(dcantidad * precio * peso, 2);
                        decimal subigv   = Math.Round(subtotal - (subtotal / 1.18m), 2);
                        dtdetalles.Rows[currentRow.RowIndex]["PrecioUnidad"] = precio;
                        dtdetalles.Rows[currentRow.RowIndex]["Cantidad"]     = dcantidad;
                        dtdetalles.Rows[currentRow.RowIndex]["SubTotal"]     = subtotal;
                        dtdetalles.Rows[currentRow.RowIndex]["Peso"]         = peso;
                        dtdetalles.Rows[currentRow.RowIndex]["igvsub"]       = subigv;
                        dtdetalles.Rows[currentRow.RowIndex]["Cantidadpeso"] = cantidadkilos;
                        dtdetalles.Rows[currentRow.RowIndex]["Unidad"]       = unidades;
                    }
                }
                else
                {
                    if (igv == 0)
                    {
                        decimal subtotal = Math.Round(dcantidad * precio, 2);
                        decimal subigv   = Math.Round(subtotal - (subtotal / (1 + igv)), 2);
                        dtdetalles.Rows[currentRow.RowIndex]["PrecioUnidad"] = precio;
                        dtdetalles.Rows[currentRow.RowIndex]["Cantidad"]     = dcantidad;
                        dtdetalles.Rows[currentRow.RowIndex]["SubTotal"]     = subtotal;
                        dtdetalles.Rows[currentRow.RowIndex]["Peso"]         = peso;
                        dtdetalles.Rows[currentRow.RowIndex]["igvsub"]       = subigv;
                        dtdetalles.Rows[currentRow.RowIndex]["Cantidadpeso"] = cantidadkilos;
                        dtdetalles.Rows[currentRow.RowIndex]["Unidad"]       = unidades;
                    }
                    else
                    {
                        decimal subtotal = Math.Round(dcantidad * precio, 2);
                        decimal subigv   = Math.Round(subtotal - (subtotal / 1.18m), 2);
                        dtdetalles.Rows[currentRow.RowIndex]["PrecioUnidad"] = precio;
                        dtdetalles.Rows[currentRow.RowIndex]["Cantidad"]     = dcantidad;
                        dtdetalles.Rows[currentRow.RowIndex]["SubTotal"]     = subtotal;
                        dtdetalles.Rows[currentRow.RowIndex]["Peso"]         = peso;
                        dtdetalles.Rows[currentRow.RowIndex]["igvsub"]       = subigv;
                        dtdetalles.Rows[currentRow.RowIndex]["Cantidadpeso"] = cantidadkilos;
                        dtdetalles.Rows[currentRow.RowIndex]["Unidad"]       = unidades;
                    }
                }
            }


            Session["detalles"] = dtdetalles;
            cargarDetalles();
            decimal total    = Util.Helper.TotalizarGrilla(grvDetalles, 6);
            decimal igvtotal = Util.Helper.TotalizarGrilla(grvDetalles, 5);

            lbligv.Text   = igvtotal.ToString();
            lbltotal.Text = total.ToString();
        }
示例#19
0
        protected void gvDriverInformation_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            this.lblMessage.Text = "";
            Guid        DriverInformationId;
            string      DriverName, LicenseNo, LicenseIssuedPlace, PlateNumber, TrailerPlateNo, Remark;
            int         Status;
            bool        isSaved = false;
            GridViewRow row     = gvDriverInformation.Rows[e.RowIndex];

            if (row != null)
            {
                TextBox      txtDriverName     = (TextBox)row.FindControl("txtEditDriverName");
                Label        lblId             = (Label)row.FindControl("lblId");
                TextBox      txtLicenseNo      = (TextBox)row.FindControl("txtLicenseNumber");
                TextBox      txtPlaceIssued    = (TextBox)row.FindControl("txtLicenseIssuedPlace");
                TextBox      txtPlateNumber    = (TextBox)row.FindControl("txtPlateNumber");
                TextBox      txtTrailerPlateNo = (TextBox)row.FindControl("txtTrailerPlateNumber");
                TextBox      txtRemark         = (TextBox)row.FindControl("txtRemark");
                DropDownList cboStatus         = (DropDownList)row.FindControl("cboStatusEdit");

                if (lblId != null)
                {
                    DriverInformationId = new Guid(lblId.Text.ToString());
                }
                else
                {
                    lblMessage.Text = "An error occured can you please try agin.If the error persists contact the administrator.";
                    return;
                }
                if (txtDriverName != null)
                {
                    DriverName = txtDriverName.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find Driver Name";
                    return;
                }
                if (txtLicenseNo != null)
                {
                    LicenseNo = txtLicenseNo.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find License Number.";
                    return;
                }
                if (txtPlaceIssued != null)
                {
                    LicenseIssuedPlace = txtPlaceIssued.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find License Place Issued.";
                    return;
                }
                if (txtPlateNo != null)
                {
                    PlateNumber = txtPlateNumber.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find License Plate Number.";
                    return;
                }
                if (txtTrailerPlateNo != null)
                {
                    TrailerPlateNo = txtTrailerPlateNo.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find Trailer Plate Number.";
                    return;
                }
                if (txtRemark != null)
                {
                    Remark = txtRemark.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find Remark.";
                    return;
                }
                if (cboStatus != null)
                {
                    Status = Convert.ToInt32(cboStatus.SelectedValue.ToString());
                }
                else
                {
                    lblMessage.Text = "Can not find Status.";
                    return;
                }
                if (Status == 0)
                {
                    if (Remark == "" || Remark == String.Empty)
                    {
                        lblMessage.Text = "Please provide Cancellation reason.";
                        return;
                    }
                }
                DriverInformationBLL objEdit = new DriverInformationBLL();
                objEdit = objEdit.GetById(DriverInformationId);
                DriverInformationBLL obj = new DriverInformationBLL();
                obj.ReceivigRequestId = new Guid(this.CommodityDepositRequestId.Value.ToString());
                obj.Id                 = DriverInformationId;
                obj.DriverName         = DriverName;
                obj.LicenseNumber      = LicenseNo;
                obj.LicenseIssuedPlace = LicenseIssuedPlace;
                obj.PlateNumber        = PlateNumber;
                obj.TrailerPlateNumber = TrailerPlateNo;
                obj.Remark             = Remark;
                obj.Status             = Status;
                try
                {
                    isSaved = obj.EditDriverInformation(objEdit);
                    if (isSaved == true)
                    {
                        this.lblMessage.Text          = "Data updated Successfully.";
                        gvDriverInformation.EditIndex = -1;


                        BindData(obj.ReceivigRequestId);
                    }
                    else
                    {
                        this.lblMessage.Text          = "Unable to update data.Please try agian.";
                        gvDriverInformation.EditIndex = -1;
                        BindData(obj.ReceivigRequestId);
                    }
                }
                catch (GRNNotOnUpdateStatus exGRN)
                {
                    this.lblMessage.Text = exGRN.msg;
                    return;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            ToggleNext();
            SingleDriver();
        }
示例#20
0
    protected void grd_Pending_Orders_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (User_Role_Id == "1" && ViewState["Operation"].ToString() == "User_Orders")
        {
            GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
            Label       lblPendingOrder_id    = (Label)row.FindControl("lblPendingOrder_id");
            Label       lbl_PendigSubrocessid = (Label)row.FindControl("lbl_PendigSubrocessid");
            Label       lbl_PendigClient_id   = (Label)row.FindControl("lblPendingCustomer_Id");
            Session["order_id"]   = lblPendingOrder_id.Text;
            Session["Order_Type"] = "Mail/fax";
            Response.Redirect("~/Admin/Order_View.aspx");
        }
        else
        {
            GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
            Label       lblPendingOrder_id    = (Label)row.FindControl("lblPendingOrder_id");
            Label       lbl_PendigSubrocessid = (Label)row.FindControl("lbl_PendigSubrocessid");
            Label       lbl_PendigClient_id   = (Label)row.FindControl("lbl_PendingClientid");
            Label       lblProduct_Type_Id    = (Label)row.FindControl("lblPendProduct_Type_Id");
            Subprocess_id = int.Parse(lbl_PendigSubrocessid.Text);
            //if (Subprocess_id == 4)
            //{
            Session["order_id"] = lblPendingOrder_id.Text;


            Session["Order_Type"] = "Web/Call";

            Session["client_Id"]     = lbl_PendigClient_id.Text;
            Session["subProcess_id"] = lbl_PendigSubrocessid.Text;


            if (lblProduct_Type_Id.Text == "1")
            {
                Response.Redirect("~/Tax_Entry/Tax_Entry.aspx");
            }
            else if (lblProduct_Type_Id.Text == "2")
            {
                Response.Redirect("~/Tax_Entry/Code_Violation.aspx");
            }

            //}
            //else if (Subprocess_id == 6)
            //{


            //    Session["order_id"] = lblPendingOrder_id.Text;


            //    Session["Order_Type"] = "Web/Call";

            //    Session["client_Id"] = lbl_PendigClient_id.Text;
            //    Session["subProcess_id"] = lbl_PendigSubrocessid.Text;
            //   //   Response.Redirect("~/Tax_Entry/Tax_Entry.aspx");
            //    Response.Redirect("~/Lereta/Tax_Entry.aspx");

            //}
            //else
            //{

            //    Session["order_id"] = lblPendingOrder_id.Text;
            //    Session["Order_Type"] = "Web/Call";
            //    Response.Redirect("~/Admin/Web_Order_Tax_Create.aspx");

            //}
        }
    }
示例#21
0
        /// <summary>
        /// EventName:gvEmployees_RowUpdating
        /// Description:Update operation on Rows
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvEmployees_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            object         id;
            SqlCommand     sqlcmd;
            SqlDataAdapter sqladapter;
            SqlDataReader  sqlreader;
            DataTable      dtEmployees;
            SqlConnection  sqlconn;
            StringBuilder  strBrUpdatequery;

            sqlconn = new SqlConnection();
            //Get the data from gridview
            id = gvEmployees.DataKeys[e.RowIndex].Value;
            GridViewRow gvrow         = gvEmployees.Rows[e.RowIndex] as GridViewRow;
            TextBox     TxtSalutation = gvrow.FindControl("TxtTitleOfCourtesy1") as TextBox;
            TextBox     Txtfname      = gvrow.FindControl("TxtFirstName1") as TextBox;
            TextBox     Txtlname      = gvrow.FindControl("TxtLastName1") as TextBox;
            TextBox     Txtbirthdy    = gvrow.FindControl("TxtBirthDate1") as TextBox;
            TextBox     Txtcity       = gvrow.FindControl("TxtCity1") as TextBox;
            TextBox     Txtcntry      = gvrow.FindControl("TxtCountry1") as TextBox;
            TextBox     Txtcontactno  = gvrow.FindControl("TxtHomePhone1") as TextBox;

            try
            {
                //connectionstring
                sqlconn.ConnectionString = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
                if (sqlconn != null && sqlconn.State == ConnectionState.Closed)
                {
                    sqlconn.Open();//open the connection
                }
                strBrUpdatequery = new StringBuilder("UPDATE Employees set ");
                strBrUpdatequery.Append("TitleOfCourtesy=@TitleOfCourtesy,FirstName=@FirstName,LastName=@LastName,");
                strBrUpdatequery.Append("BirthDate=@BirthDate,");
                strBrUpdatequery.Append("City=@City,Country=@Country,HomePhone=@HomePhone");
                strBrUpdatequery.Append(" WHERE EmployeeID=@EmployeeID;");
                sqlcmd = new SqlCommand(strBrUpdatequery.ToString(), sqlconn);
                //Update the data
                sqlcmd.Parameters.AddWithValue("@EmployeeID", SqlDbType.Int).Value           = id;
                sqlcmd.Parameters.AddWithValue("@TitleOfCourtesy", SqlDbType.NVarChar).Value = TxtSalutation.Text;
                sqlcmd.Parameters.AddWithValue("@FirstName", SqlDbType.NVarChar).Value       = Txtfname.Text;
                sqlcmd.Parameters.AddWithValue("@LastName", SqlDbType.NVarChar).Value        = Txtlname.Text;
                sqlcmd.Parameters.AddWithValue("@BirthDate", SqlDbType.DateTime).Value       = Txtbirthdy.Text;
                sqlcmd.Parameters.AddWithValue("@City", SqlDbType.NVarChar).Value            = Txtcity.Text;
                sqlcmd.Parameters.AddWithValue("@Country", SqlDbType.NVarChar).Value         = Txtcntry.Text;
                sqlcmd.Parameters.AddWithValue("@HomePhone", SqlDbType.NVarChar).Value       = Txtcontactno.Text;
                //Execute Query
                sqladapter = new SqlDataAdapter(sqlcmd);
                sqlcmd.ExecuteNonQuery();
                sqlreader   = sqlcmd.ExecuteReader();//Reading data
                dtEmployees = new DataTable();
                dtEmployees.Load(sqlreader);
                gvEmployees.DataSource = dtEmployees;
                gvEmployees.DataBind();
                gvEmployees.EditIndex = -1;
                Grid_Fill();//Display Gridview
                objconstmsg = new ConstantMessages();
                ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "alert('" + objconstmsg.stralertmessage + "');", true);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);//Exception
            }
            finally
            {
                if (sqlconn.State == ConnectionState.Open)
                {
                    sqlconn.Close();
                }
                sqlcmd           = null;
                sqladapter       = null;
                sqlreader        = null;
                dtEmployees      = null;
                strBrUpdatequery = null;
            }
        }
示例#22
0
        protected void btn_XSDY_Click(object sender, EventArgs e)
        {
            string userid = Session["UserID"].ToString();

            if (userid == LabelDocumentid.Text)
            {
                int temp = isselected1();
                if (temp == 0)//是否选择数据
                {
                    string sqltext = "";
                    string ptcode  = "";
                    string marid   = "";
                    double length  = 0;
                    double width   = 0;
                    double num     = 0;
                    double fznum   = 0;
                    string pjid    = "";
                    string engid   = "";
                    string mpcode  = generatecode();
                    globlempcode = mpcode;
                    string fillid    = Session["UserID"].ToString();
                    string filltime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    string reviewaid = "";
                    string chargeid  = "";

                    string sql = "select PR_PJID,PR_ENGID,PR_SQREID,PR_FZREID from TBPC_PCHSPLANRVW where PR_SHEETNO='" + gloabcode + "'";
                    System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sql);
                    if (dt.Rows.Count > 0)
                    {
                        pjid      = dt.Rows[0]["PR_PJID"].ToString();
                        engid     = dt.Rows[0]["PR_ENGID"].ToString();
                        reviewaid = dt.Rows[0]["PR_SQREID"].ToString();
                        chargeid  = dt.Rows[0]["PR_FZREID"].ToString();
                    }
                    sqltext = "INSERT INTO TBPC_MARREPLACETOTAL(MP_CODE,MP_PLANPCODE,MP_PJID," +
                              "MP_ENGID,MP_FILLFMID,MP_FILLFMTIME,MP_REVIEWAID,MP_CHARGEID)  " +
                              "VALUES('" + mpcode + "','" + gloabcode + "','" + pjid + "','" + engid + "','" + fillid + "'," +
                              "'" + filltime + "','" + reviewaid + "','" + chargeid + "')";
                    DBCallCommon.ExeSqlText(sqltext);
                    for (int i = 0; i < GridView1.Rows.Count; i++)
                    {
                        GridViewRow gr = GridView1.Rows[i];
                        System.Web.UI.WebControls.CheckBox cbk = (System.Web.UI.WebControls.CheckBox)gr.FindControl("CheckBox1");
                        if (cbk.Checked)
                        {
                            ptcode  = ((System.Web.UI.WebControls.Label)gr.FindControl("PlanCode")).Text;
                            marid   = ((System.Web.UI.WebControls.Label)gr.FindControl("MaterialCode")).Text;
                            length  = Convert.ToDouble(((System.Web.UI.WebControls.Label)gr.FindControl("Length")).Text);
                            width   = Convert.ToDouble(((System.Web.UI.WebControls.Label)gr.FindControl("Width")).Text);
                            num     = Convert.ToDouble(((System.Web.UI.WebControls.Label)gr.FindControl("Number")).Text);
                            fznum   = Convert.ToDouble(((System.Web.UI.WebControls.Label)gr.FindControl("fznum")).Text);
                            sqltext = "INSERT INTO TBPC_MARREPLACEALL(MP_CODE,MP_PTCODE,MP_MARID," +
                                      "MP_NUM,MP_FZNUM,MP_LENGTH,MP_WIDTH) " +
                                      "VALUES('" + mpcode + "','" + ptcode + "','" + marid + "'," +
                                      +num + "," + fznum + "," + length + "," + width + ")";
                            DBCallCommon.ExeSqlText(sqltext);
                        }
                    }
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "openclosemodewin();", true);
                }
                else if (temp == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您没有选择数据,本次操作无效!');", true);
                }
                else if (temp == 2)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('你选择了已经提交相似代用审核的数据!');", true);
                }
                else if (temp == 3)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('你选择了不是同一批计划的物料!');", true);
                }
                else if (temp == 4)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('选择了未关闭的数据,需要先关闭,再相似代用!');", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您无权进行操作!');", true);
            }
        }
示例#23
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                string Id = GridView1.DataKeys[e.RowIndex].Values[0].ToString();


                GridViewRow row = GridView1.Rows[e.RowIndex];


                TextBox      Question    = (TextBox)row.FindControl("Question");
                TextBox      optA        = (TextBox)row.FindControl("optA");
                TextBox      optB        = (TextBox)row.FindControl("optB");
                TextBox      optC        = (TextBox)row.FindControl("optC");
                TextBox      optD        = (TextBox)row.FindControl("optD");
                DropDownList ddlAnswer   = (DropDownList)row.FindControl("ddlAnswer");
                FileUpload   FileUpload1 = (FileUpload)row.FindControl("FileUpload1");
                string       query       = "";
                byte[]       bytes       = null;
                if (FileUpload1 != null)
                {
                    if (FileUpload1.HasFile)
                    {
                        //SqlDataSource2.UpdateCommand = "UPDATE [tblQuestion] SET [Question] = @Question, [ImgQuestion] = @ImgQuestion, [optA] = @optA, [optB] = @optB," +
                        //                                            "[optC] = @optC, [optD] = @optD, [Answer] = @Answer WHERE[Id] = @Id";
                        query = "UPDATE [tblQuestion] SET [Question] = @Question, [ImgQuestion] = @ImgQuestion, [optA] = @optA, [optB] = @optB, " +
                                "[optC] = @optC, [optD] = @optD, [Answer] = @Answer WHERE [Id] = @Id";
                        using (BinaryReader br = new BinaryReader(FileUpload1.PostedFile.InputStream))
                        {
                            bytes = br.ReadBytes(FileUpload1.PostedFile.ContentLength);
                        }
                    }
                }
                else
                {
                    //SqlDataSource2.UpdateCommand = "UPDATE [tblQuestion] SET [Question] = @Question,  [optA] = @optA, [optB] = @optB," +
                    //                                            "[optC] = @optC, [optD] = @optD, [Answer] = @Answer WHERE[Id] = @Id";
                    query = "UPDATE [tblQuestion] SET [Question] = @Question,  [optA] = @optA, [optB] = @optB, " +
                            "[optC] = @optC, [optD] = @optD, [Answer] = @Answer WHERE [Id] = @Id";
                    bytes = null;
                }


                using (cn)
                {
                    using (SqlCommand cmd = new SqlCommand(query, cn))
                    {
                        cmd.Parameters.AddWithValue("@Question", Question.Text);
                        if (bytes != null)
                        {
                            cmd.Parameters.AddWithValue("@ImgQuestion", bytes);
                        }
                        cmd.Parameters.AddWithValue("@optA", optA.Text);
                        cmd.Parameters.AddWithValue("@optB", optB.Text);
                        cmd.Parameters.AddWithValue("@optC", optC.Text);
                        cmd.Parameters.AddWithValue("@optD", optD.Text);
                        cmd.Parameters.AddWithValue("@Answer", ddlAnswer.SelectedValue);
                        cmd.Parameters.AddWithValue("@Id", Id);
                        cn.Open();
                        cmd.ExecuteNonQuery();
                        cn.Close();
                        // Response.Redirect("ViewTestQuestions.aspx");
                    }
                }
                // SqlDataSource2.Update();
                // GridView1.EditIndex = -1;
                // GridView1.DataBind();
                SqlDataSource2.DataBind();
                GridView1.EditIndex = -1;
                GridView1.DataBind();
            }
            catch (Exception ex)
            {
            }
        }
 /// <summary>
 /// Initialize booking mode detail values
 /// </summary>
 /// <param name="row">Footer row from Gridview</param>
 /// <returns>returns booking mode detail object</returns>
 private BookingModeDetailDTO InitializeBookingModeDetails(GridViewRow row)
 {
     BookingModeDetailDTO bookingModeDetails = new BookingModeDetailDTO();
     bookingModeDetails.BookingDetails_Mode_Id = Convert.ToInt32(((DropDownList)row.FindControl("ddlBookingMode")).SelectedItem.Value);
     bookingModeDetails.BookingDetails_Date = DateTime.Today;
     string startTime = ((DropDownList)row.FindControl("ddlStartTime")).SelectedItem.Text;
     bookingModeDetails.BookingDetails_StartTime = new TimeSpan(Convert.ToDateTime(startTime).Hour, Convert.ToDateTime(startTime).Minute, 0);
     string endTime = ((DropDownList)row.FindControl("ddlEndTime")).SelectedItem.Text;
     bookingModeDetails.BookingDetails_EndTime = new TimeSpan(Convert.ToDateTime(endTime).Hour, Convert.ToDateTime(endTime).Minute, 0);
     string timeInterval = ((TextBox)row.FindControl("txtTimeInterval")).Text;
     if (!string.IsNullOrEmpty(timeInterval))
     {
         bookingModeDetails.BookingDetails_TimeInterval = Convert.ToInt32(((TextBox)row.FindControl("txtTimeInterval")).Text);
     }
     bookingModeDetails.BookingDetails_Trucks = Convert.ToInt32(((TextBox)row.FindControl("txtTruckLimit")).Text);
     return bookingModeDetails;
 }
示例#25
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            conn.Open();
            string        major    = "";
            string        uptmb    = "select mb from makecart where userr='" + Session["user"].ToString() + "' AND mb !='" + major + "'";
            SqlCommand    cmd25    = new SqlCommand(uptmb, conn);
            SqlDataReader reader21 = cmd25.ExecuteReader();
            if (reader21.HasRows)
            {
                reader21.Read();
                string no = reader21.GetValue(0).ToString();
                reader21.Close();

                string        ramslot = "select mbslot from makecart where userr='" + Session["user"].ToString() + "' AND mb = '" + no + "'";
                SqlCommand    cmdd2   = new SqlCommand(ramslot, conn);
                SqlDataReader reader2 = cmdd2.ExecuteReader();
                reader2.Read();
                string gym     = reader2.GetValue(0).ToString();
                int    gputot3 = int.Parse(gym);
                reader2.Close();

                string        gslot   = "select gpuslot from makecart where userr='" + Session["user"].ToString() + "' AND mb = '" + no + "'";
                SqlCommand    cmdd4   = new SqlCommand(gslot, conn);
                SqlDataReader reader4 = cmdd4.ExecuteReader();
                reader4.Read();
                string noo    = reader4.GetValue(0).ToString();
                int    gputot = int.Parse(noo);
                reader4.Close();

                string        q3      = "select mbprice from makecart where userr ='" + Session["user"].ToString() + "' AND mb = '" + no + "'";
                SqlCommand    cmd3    = new SqlCommand(q3, conn);
                SqlDataReader reader3 = cmd3.ExecuteReader();
                reader3.Read();
                string gym3    = reader3.GetValue(0).ToString();
                int    gputot4 = int.Parse(gym3);
                reader3.Close();
                GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);

                Label pro     = (Label)row.FindControl("Label1");
                Label mbprice = (Label)row.FindControl("Label2");

                int pri = int.Parse(mbprice.Text);

                string     ordp  = "insert into makecart(userr,product,mb,mbprice,mbslot,gpuslot,keyboard,keyboardprice) values('" + Session["user"].ToString() + "','keyboard','" + no + "','" + gputot4 + "','" + gputot3 + "','" + gputot + "','" + pro.Text + "','" + pri + "')";
                SqlCommand cmddd = new SqlCommand(ordp, conn);
                cmddd.ExecuteNonQuery();
                conn.Close();
                Response.Write(" <script>window.alert('keyboard Added');</script>");
                Response.Redirect("~/User/startpc.aspx");
            }
        }
        else if (e.CommandName == "Insert")
        {
            Panel1.Visible = true;


            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            conn.Open();



            GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            Label       pro = (Label)row.FindControl("Label1");


            string        gg      = "select * from keyboard where man='" + pro.Text + "'";
            SqlCommand    cmdd    = new SqlCommand(gg, conn);
            SqlDataReader readerr = cmdd.ExecuteReader();

            if (readerr.HasRows)
            {
                readerr.Read();
                Label11.Text = readerr.GetString(5);
                Label12.Text = readerr.GetString(6);
                Label13.Text = readerr.GetString(7);
                Label14.Text = readerr.GetString(8);
                Label15.Text = readerr.GetString(9);
                readerr.Close();
            }


            string        q3      = "select des from keyboard where man='" + pro.Text + "'";
            SqlCommand    cmd3    = new SqlCommand(q3, conn);
            SqlDataReader reader3 = cmd3.ExecuteReader();
            if (reader3.HasRows)
            {
                reader3.Read();
                string keydes = reader3.GetString(0).ToString();
                if (keydes == "Gaming")
                {
                    Label23.Text = "This keyboard is more prefered by gamers";
                }
                else if (keydes == "Office")
                {
                    Label23.Text = "Office purpose keyboard";
                }
                else if (keydes == "General")
                {
                    Label23.Text = "All purpose keyboard";
                }
                else
                {
                    Label23.Text = "104-key Windows Standard keyboard";
                }
            }
            else
            {
                Label23.Text = "No keyboard Found";
            }
        }
    }
    private string GetTextBoxValue(GridViewRow currentRow, string controlName)
    {
        string textBoxValue = string.Empty;
        if (currentRow.FindControl(controlName).Visible == true)
        {
            textBoxValue = ((TextBox)currentRow.FindControl(controlName)).Text;
        }

        return textBoxValue;
    }
示例#27
0
    /// <summary>
    /// When image of either "Approve","Reject" or "View" is clicked this event is captured and
    /// the command associated with it is executed.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gvPendingApprovalOfMrf_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName != SORT)
            {
                GridView gridView = (GridView)sender;
                selectedIndex = int.Parse(e.CommandArgument.ToString());
                commandName   = e.CommandName;

                gvPendingApprovalOfMrf.SelectedIndex = selectedIndex;
                mrfDetail = new BusinessEntities.MRFDetail();

                GridViewRow gvRow                = gvPendingApprovalOfMrf.Rows[selectedIndex];
                Label       lbl                  = (Label)gvRow.Cells[0].FindControl("lblMrfId");
                Label       lblEmpId             = (Label)gvRow.FindControl("lblEMPId");
                Label       lblFunctionalManager = (Label)gvRow.FindControl("lblFunctionalManager");

                //Extract the MrfId and role From grid.
                //Role is extracted to check if role is PM/SPM/APM than it is handled in different manner.
                mrfDetail.MRFId             = Convert.ToInt32(lbl.Text);
                mrfDetail.MRFCode           = gvRow.Cells[1].Text;
                mrfDetail.EmployeeName      = gvRow.Cells[2].Text;
                mrfDetail.ResourceOnBoard   = DateTime.Parse(gvRow.Cells[3].Text);
                mrfDetail.DepartmentName    = gvRow.Cells[6].Text;
                mrfDetail.ProjectName       = gvRow.Cells[8].Text;
                mrfDetail.Role              = gvRow.Cells[10].Text;
                mrfDetail.EmployeeId        = Convert.ToInt32(lblEmpId.Text);
                mrfDetail.ClientName        = gvRow.Cells[9].Text;
                mrfDetail.FunctionalManager = lblFunctionalManager.Text;

                Session[SessionNames.MRFDETAIL_APPREJMRF] = mrfDetail;

                //Depending upon the comand, perform the action.
                switch (commandName)
                {
                case APPROVE:
                    pnlApprove.Visible = true;
                    pnlReject.Visible  = false;
                    txtComment.Focus();
                    //This line of code is added since on click of "Approve" the Sort image used to get disappear.
                    //The "If" condition check is made since for One record sort image is not required.
                    if (gvPendingApprovalOfMrf.Rows.Count > 1)
                    {
                        AddSortImage(gvPendingApprovalOfMrf.HeaderRow);
                    }
                    //Mandatory label is made visible.
                    lblMandatory.Visible = true;
                    break;

                case REJECT:
                    pnlApprove.Visible = false;
                    pnlReject.Visible  = true;
                    txtReject.Focus();
                    //This line of code is added since on click of "Reject" the Sort image used to get disappear.
                    //The "If" condition check is made since for One record sort image is not required.
                    if (gvPendingApprovalOfMrf.Rows.Count > 1)
                    {
                        AddSortImage(gvPendingApprovalOfMrf.HeaderRow);
                    }
                    //Mandatory label is made visible.
                    lblMandatory.Visible = true;
                    break;

                case VIEW:
                    string url = "MrfView.aspx?" + URLHelper.SecureParameters("MRFId", mrfDetail.MRFId.ToString()) + "&" + URLHelper.SecureParameters("index", gvRow.RowIndex.ToString()) + "&" + URLHelper.SecureParameters("pagetype", "APPREJFINANCE") + "&" + URLHelper.CreateSignature(mrfDetail.MRFId.ToString(), gvRow.RowIndex.ToString(), "APPREJFINANCE");
                    Response.Redirect(url, false);
                    //Server.Transfer(url);
                    break;
                }
            }
        }

        //catches RaveHRException exception
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME_MRFPENDINGAPPROVAL, "gvPendingApprovalOfMrf_RowCommand", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
 private TextBox GetCurrentQtyTextBox(GridViewRow gvr)
 {
     return (TextBox)gvr.FindControl("tbCurrentQty");
 }
    protected void dgInvoiceDettail_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if ((string)e.CommandArgument == "0" || (string)e.CommandArgument == "")
            {
                return;
            }
            if (e.CommandName.Equals("View"))
            {
                if (CommonClasses.ValidRights(int.Parse(right.Substring(1, 1)), this, "For View"))
                {
                    string type     = "VIEW";
                    string inv_code = e.CommandArgument.ToString();
                    Response.Redirect("~/Transactions/ADD/DispatchToSubCon.aspx?c_name=" + type + "&inv_code=" + inv_code, false);
                }
                else
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "You Have No Rights To View";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    //ShowMessage("#Avisos", "You Have No Rights To View", CommonClasses.MSG_Erro);
                    return;
                }
            }
            if (e.CommandName.Equals("Modify"))
            {
                if (CommonClasses.ValidRights(int.Parse(right.Substring(2, 1)), this, "For Modify"))
                {
                    if (!ModifyLog(e.CommandArgument.ToString()))
                    {
                        Index = Convert.ToInt32(e.CommandArgument.ToString());
                        //GridViewRow row = dgInvoiceDettail.Rows[Index];
                        DataTable dtcheck = new DataTable();

                        GridViewRow row      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                        int         RowIndex = row.RowIndex;                            // this find the index of row

                        string varName1 = ((Label)row.FindControl("lblINM_DATE")).Text; //this store the  value in varName1

                        //string inv_no = ((Label)(row.FindControl("lblINM_NO"))).Text;
                        dtcheck = CommonClasses.Execute(" SELECT *  FROM CHALLAN_STOCK_LEDGER where CL_DOC_TYPE='IWIAP' AND CL_CH_NO IN (SELECT  CL_CH_NO  FROM CHALLAN_STOCK_LEDGER  WHERE CL_DOC_TYPE='OutSUBINM' AND  CL_DOC_ID='" + Index + "'  ) AND CL_DATE='" + Convert.ToDateTime(varName1).ToString("dd/MMM/yyyy") + "'");
                        if (dtcheck.Rows.Count > 0)
                        {
                            PanelMsg.Visible = true;
                            lblmsg.Text      = "Used In Inward you can't Modify It.";
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                            return;
                        }
                        else
                        {
                            string type     = "MODIFY";
                            string inv_code = e.CommandArgument.ToString();
                            Response.Redirect("~/Transactions/ADD/DispatchToSubCon.aspx?c_name=" + type + "&inv_code=" + inv_code, false);
                        }
                    }
                }
                else
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "You Have No Rights To Modify";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                    return;
                }
            }
            if (e.CommandName.Equals("Print"))
            {
                if (CommonClasses.ValidRights(int.Parse(right.Substring(5, 1)), this, "For Print"))
                {
                    if (!ModifyLog(e.CommandArgument.ToString()))
                    {
                        //string type = "MODIFY";
                        string inv_code = e.CommandArgument.ToString();
                        string type     = "Single";
                        //Response.Redirect("~/RoportForms/ADD/DispToSubContPrint.aspx?inv_code=" + inv_code + "&type=" + type, false);
                        Response.Redirect("~/RoportForms/VIEW/ViewDispToSubReport.aspx?inv_code=" + inv_code + "&type=" + type, false);
                    }
                }
                else
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "You Have No Rights To Print";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                    return;
                }
            }


            if (e.CommandName.Equals("PrintMult"))
            {
                if (!ModifyLog(e.CommandArgument.ToString()))
                {
                    //string type = "MODIFY";
                    string inv_code = e.CommandArgument.ToString();
                    string type     = "Mult";
                    Response.Redirect("~/RoportForms/VIEW/ViewDispToSubReport.aspx?inv_code=" + inv_code + "&type=" + type, false);
                }
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("DISPATCH TO SUB CONTRACTOR View", "dgInvoiceDettail_RowCommand", Ex.Message);
        }
    }
    protected void gvPUNCH_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
    {
        GridViewRow gr = e.Row;

        if (gr.RowType == DataControlRowType.DataRow)
        {
            KYTJsonDict dict             = null;
            DataRowView row              = (DataRowView)e.Row.DataItem;
            Label       lblZTABLE_STATUS = gr.FindControl("lblZTABLE_STATUS") as Label;
            Label       lblWS_STATUS     = gr.FindControl("lblWS_STATUS") as Label;
            Label       lblDOC_NBR       = gr.FindControl("lblDOC_NBR") as Label;
            Label       lblAPPLICANT     = gr.FindControl("lblAPPLICANT") as Label;
            Label       lblAPPLICANTDATE = gr.FindControl("lblAPPLICANTDATE") as Label;
            Label       lblSTARTTIME     = gr.FindControl("lblSTARTTIME") as Label;
            Label       lblENDTIME       = gr.FindControl("lblENDTIME") as Label;
            Label       lblMSG           = gr.FindControl("lblMSG") as Label;

            bool   isRightField = false;
            string DOC_NBR      = row["DOC_NBR"].ToString();
            using (SqlDataAdapter sda = new SqlDataAdapter(@"
                SELECT TOP 1 * 
                  FROM TB_WKF_TASK 
                 WHERE DOC_NBR = @DOC_NBR 
            ", new DatabaseHelper().Command.Connection.ConnectionString))
                using (DataSet ds = new DataSet())
                {
                    sda.SelectCommand.Parameters.AddWithValue("@DOC_NBR", DOC_NBR);
                    try
                    {
                        if (sda.Fill(ds) > 0)
                        {
                            DataRow     dr  = ds.Tables[0].Rows[0];
                            XmlDocument doc = new XmlDocument();
                            doc.LoadXml(dr["CURRENT_DOC"].ToString());
                            XmlNode node = doc.SelectSingleNode("//Form/FormFieldValue/FieldItem[@fieldId='" + Field_ID + "']"); // 取出外掛欄位資料
                            isRightField = node != null;
                            if (isRightField)
                            {
                                dict = JsonConvert.DeserializeObject <KYTJsonDict>(HttpUtility.HtmlDecode(node.InnerText));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        DebugLog.Log(DebugLog.LogLevel.Error, string.Format(@"WEB_KYTI_SCSHR_PUNCH_ERR_FIX.gvPUNCH_RowDataBound.TB_WKF_TASK.SELECT.ERROR:{0}", ex.Message));
                    }
                }
            if (isRightField)
            {
                string ZTABLE_STATUS = ReBuildSCSHRForm.CheckZTableHasData(DOC_NBR, Field_ID);
                string WS_STATUS     = ReBuildSCSHRForm.CheckWSHasData(DOC_NBR, Field_ID);

                lblZTABLE_STATUS.Text      = !string.IsNullOrEmpty(ZTABLE_STATUS) ? ZTABLE_STATUS == "0" ? "O" : "X" : "?";
                lblZTABLE_STATUS.ForeColor = !string.IsNullOrEmpty(ZTABLE_STATUS) ? ZTABLE_STATUS == "0" ? Color.Green : Color.Red : Color.Yellow;

                lblWS_STATUS.Text      = !string.IsNullOrEmpty(WS_STATUS) ? WS_STATUS == "0" ? "O" : "X" : "?";
                lblWS_STATUS.ForeColor = !string.IsNullOrEmpty(WS_STATUS) ? WS_STATUS == "0" ? Color.Green : Color.Red : Color.Yellow;
                lblSTARTTIME.Text      = (string)dict.GetString("kdtpFOPUNCH_TIME");
                lblENDTIME.Text        = (string)dict.GetString("kdtpFOPUNCH_TIME_OFF");
                lblAPPLICANT.Text      = (string)dict.GetString("ktxtAPPLICANT");
                lblAPPLICANTDATE.Text  = (string)dict.GetString("ktxtAPPLICANTDATE");
            }
        }
    }
示例#31
0
 private Visualization_InvVisualBoard_Kanban GetKanbanControl(GridViewRow gvr)
 {
     return((Visualization_InvVisualBoard_Kanban)gvr.FindControl("ucKanban"));
 }
示例#32
0
        protected void btnrate_Click(object sender, EventArgs e)
        {
            Button      btnEdit            = (Button)sender;
            GridViewRow Grow               = (GridViewRow)btnEdit.NamingContainer;
            Label       lblpropertyid      = (Label)Grow.FindControl("lblpropertyid");
            Label       lblpropertyaddress = (Label)Grow.FindControl("lblpropertyaddress");
            Label       lblcity            = (Label)Grow.FindControl("lblcity");
            Label       lblstate           = (Label)Grow.FindControl("lblstate");
            Label       lblzipcode         = (Label)Grow.FindControl("lblzipcode");
            TextBox     txtreviews         = (TextBox)Grow.FindControl("txtreviews");
            RadioButton rdbtnrating1       = (RadioButton)Grow.FindControl("rdbtnrating1");
            RadioButton rdbtnrating2       = (RadioButton)Grow.FindControl("rdbtnrating2");
            RadioButton rdbtnrating3       = (RadioButton)Grow.FindControl("rdbtnrating3");
            RadioButton rdbtnrating4       = (RadioButton)Grow.FindControl("rdbtnrating4");
            RadioButton rdbtnrating5       = (RadioButton)Grow.FindControl("rdbtnrating5");
            Label       lbllnadlord        = (Label)Grow.FindControl("lbllnadlord");
            Label       lbltenant          = (Label)Grow.FindControl("lbltenant");

            int  ratings   = 0;
            bool flagcheck = false;

            if (rdbtnrating1.Checked == true)
            {
                ratings   = 5;
                flagcheck = true;
            }
            else if (rdbtnrating2.Checked == true)
            {
                ratings   = 4;
                flagcheck = true;
            }
            else if (rdbtnrating3.Checked == true)
            {
                ratings   = 3;
                flagcheck = true;
            }
            else if (rdbtnrating4.Checked == true)
            {
                ratings   = 2;
                flagcheck = true;
            }
            else if (rdbtnrating5.Checked == true)
            {
                ratings   = 1;
                flagcheck = true;
            }
            string propertyid      = lblpropertyid.Text;
            string propertyaddress = lblpropertyaddress.Text;
            string propertycity    = lblcity.Text;
            string RateToUserId    = string.Empty;

            if (ViewState["UserType"].ToString() == "Landlord")
            {
                RateToUserId = lbltenant.Text;
            }
            else if (ViewState["UserType"].ToString() == "Tenant")
            {
                RateToUserId = lbllnadlord.Text;
            }

            if (flagcheck == true)
            {
                dsrating = submitratingsDA.INSERT_SUBMIT_RATINGS_DETAILS(0, Convert.ToInt32(Session["UserID"]), Convert.ToInt32(RateToUserId), ratings, txtreviews.Text, propertyaddress, propertycity, lblstate.Text, lblzipcode.Text, Convert.ToInt32(propertyid));

                if (dsrating != null && dsrating.Tables[0].Rows.Count > 0)
                {
                    if (dsrating.Tables[0].Rows[0]["COUNT"].ToString() == "0")
                    {
                        lblvalidationmessage.Text = "Your Ratings and Reviews submitted Successfully";
                    }
                    else if (dsrating.Tables[0].Rows[0]["COUNT"].ToString() == "0")
                    {
                        lblvalidationmessage.Text = "Your Ratings and Reviews updated Successfully.";
                    }
                }
            }
            else
            {
                lblvalidationmessage.Text = "It is required to make a selection to submit ratings.";
            }
        }
        //获取当前GridView1中的数据,根据表格内容调整
        protected DataTable getDataFromGridView()
        {
            DataTable tb = new DataTable();

            tb.Columns.Add("UniqueID", System.Type.GetType("System.String"));
            tb.Columns.Add("SQCODE", System.Type.GetType("System.String"));
            tb.Columns.Add("MaterialCode", System.Type.GetType("System.String"));
            tb.Columns.Add("MaterialName", System.Type.GetType("System.String"));
            tb.Columns.Add("Attribute", System.Type.GetType("System.String"));
            tb.Columns.Add("GB", System.Type.GetType("System.String"));
            tb.Columns.Add("MaterialStandard", System.Type.GetType("System.String"));
            tb.Columns.Add("Fixed", System.Type.GetType("System.String"));
            tb.Columns.Add("Length", System.Type.GetType("System.String"));
            tb.Columns.Add("Width", System.Type.GetType("System.String"));
            tb.Columns.Add("LotNumber", System.Type.GetType("System.String"));
            tb.Columns.Add("PTCFrom", System.Type.GetType("System.String"));
            tb.Columns.Add("Warehouse", System.Type.GetType("System.String"));
            tb.Columns.Add("WarehouseCode", System.Type.GetType("System.String"));
            tb.Columns.Add("Position", System.Type.GetType("System.String"));
            tb.Columns.Add("PositionCode", System.Type.GetType("System.String"));
            tb.Columns.Add("Unit", System.Type.GetType("System.String"));
            tb.Columns.Add("WN", System.Type.GetType("System.String"));
            tb.Columns.Add("WQN", System.Type.GetType("System.String"));
            tb.Columns.Add("PTCTo", System.Type.GetType("System.String"));
            tb.Columns.Add("PlanMode", System.Type.GetType("System.String"));
            tb.Columns.Add("AdjN", System.Type.GetType("System.String"));
            tb.Columns.Add("AdjQN", System.Type.GetType("System.String"));
            tb.Columns.Add("Note", System.Type.GetType("System.String"));
            tb.Columns.Add("OrderID", System.Type.GetType("System.String"));
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                GridViewRow gRow   = GridView1.Rows[i];
                DataRow     newRow = tb.NewRow();
                newRow["UniqueID"]         = ((Label)gRow.FindControl("LabelUniqueID")).Text;
                newRow["SQCODE"]           = ((Label)gRow.FindControl("LabelSQCODE")).Text;
                newRow["MaterialCode"]     = ((Label)gRow.FindControl("LabelMaterialCode")).Text;
                newRow["MaterialName"]     = ((Label)gRow.FindControl("LabelMaterialName")).Text;
                newRow["Attribute"]        = ((Label)gRow.FindControl("LabelAttribute")).Text;
                newRow["GB"]               = ((Label)gRow.FindControl("LabelGB")).Text;
                newRow["MaterialStandard"] = ((Label)gRow.FindControl("LabelMaterialStandard")).Text;
                newRow["Fixed"]            = ((Label)gRow.FindControl("LabelFixed")).Text;
                newRow["Length"]           = ((Label)gRow.FindControl("LabelLength")).Text;
                newRow["Width"]            = ((Label)gRow.FindControl("LabelWidth")).Text;
                newRow["LotNumber"]        = ((Label)gRow.FindControl("LabelLotNumber")).Text;
                newRow["PTCFrom"]          = ((Label)gRow.FindControl("LabelPTCFrom")).Text;
                newRow["Warehouse"]        = ((Label)gRow.FindControl("LabelWarehouse")).Text;
                newRow["WarehouseCode"]    = ((Label)gRow.FindControl("LabelWarehouseCode")).Text;
                newRow["Position"]         = ((Label)gRow.FindControl("LabelPosition")).Text;
                newRow["PositionCode"]     = ((Label)gRow.FindControl("LabelPositionCode")).Text;
                newRow["Unit"]             = ((Label)gRow.FindControl("LabelUnit")).Text;
                newRow["WN"]               = ((Label)gRow.FindControl("LabelWN")).Text;
                newRow["WQN"]              = ((Label)gRow.FindControl("LabelWQN")).Text;
                newRow["PTCTo"]            = ((Label)gRow.FindControl("LabelPTCTo")).Text;
                newRow["PlanMode"]         = ((Label)gRow.FindControl("LabelPlanMode")).Text;
                newRow["AdjN"]             = ((TextBox)gRow.FindControl("TextBoxAdjN")).Text;
                newRow["AdjQN"]            = ((TextBox)gRow.FindControl("TextBoxAdjQN")).Text;
                newRow["Note"]             = ((TextBox)gRow.FindControl("TextBoxNote")).Text;
                newRow["OrderID"]          = ((Label)gRow.FindControl("LabelOrderID")).Text;
                tb.Rows.Add(newRow);
            }
            return(tb);
        }
示例#34
0
        protected void gvDTpop_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         index        = 0;
            GridViewRow gvr          = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         CurrentIndex = gvr.RowIndex;

            if (e.CommandName.Equals("View"))
            {
                IndexChangeBiz biz = new IndexChangeBiz();
                //GridViewRow gr = (GridViewRow)((LinkButton)sender).NamingContainer;
                var lblUPLOAD_GROUP_NO = (Label)gvr.FindControl("lblUPLOAD_GROUP_NO");
                DTO.ResponseService <DTO.PersonLicenseDetail[]> ls = biz.GetIndexLicenseD(lblUPLOAD_GROUP_NO.Text.Trim());

                //For Test 131029132814315
                //DTO.ResponseService<DTO.PersonLicenseDetail[]> ls = biz.GetIndexLicenseD("131029132814315");
                if (ls.DataResponse != null)
                {
                    gvLicenseD.DataSource = ls.DataResponse;
                    gvLicenseD.DataBind();
                    modalMain.Show();
                    modalMain2.Show();
                    modalMain3.Show();
                }
            }
            else
            {
                if (e.CommandName == "Up")
                {
                    int rowcount = this.gvDTpop.Rows.Count;
                    for (int i = 0; i < rowcount; i++)
                    {
                        index++;
                    }

                    //Get Row Index
                    int RowIndex = int.Parse(e.CommandArgument.ToString());
                    if (RowIndex < 1)
                    {
                        this.ucError.ShowMessageError = "Can't moveup";
                        this.ucError.ShowModalError();
                        this.modalMain.Show();
                        this.modalMain2.Show();
                        return;
                    }
                }
                else
                {
                    int rowcount = this.gvDTpop.Rows.Count;
                    for (int i = 0; i < rowcount; i++)
                    {
                        index++;
                    }

                    //Get Row Index
                    int RowIndex = int.Parse(e.CommandArgument.ToString());
                    RowIndex = RowIndex + 1;
                    if (RowIndex >= index)
                    {
                        this.ucError.ShowMessageError = "Can't movedown";
                        this.ucError.ShowModalError();
                        this.modalMain.Show();
                        this.modalMain2.Show();
                        return;
                    }
                }

                List <DTO.SubPaymentDetail> newls = this.SortDescriptionsDT(this.CurrentSessionListDT, CurrentIndex, e.CommandName);

                //Rebind
                this.gvDTpop.DataSource = newls;
                this.gvDTpop.DataBind();

                udpMain.Update();
                modalMain.Show();
                modalMain2.Show();
            }
        }
示例#35
0
    private void UpdateItem(GridViewRow gvr)
    {
        if (gvr != null)
        {
            string model = string.Empty;
            TextBox txtOrderQty = gvr.Cells[3].FindControl("txtOrderQty") as TextBox;
            DropDownList dropPriority = gvr.Cells[3].FindControl("ddlOrderPriority") as DropDownList;

            Label lbModel = gvr.Cells[1].FindControl("lbModel") as Label;
            if (lbModel.Visible)    // not on sale model
                model = lbModel.ToolTip;
            else    //if (string.IsNullOrEmpty(model))
            {
                DropDownList ddlItem = gvr.Cells[3].FindControl("ddlItem") as DropDownList;
                model = ddlItem.SelectedValue;
            }

            int index = int.Parse(gvr.Cells[0].Text) - 1;
            VDMS.Core.Domain.Item it = Order.GetItemById(model);

            if (it == null)
            {
                _items[index].Item = new Item() { Id = string.Empty };
                gvr.Cells[2].Text = string.Empty;
                gvr.Cells[4].Text = "0";
                _items[index].Orderqty = 0;
                _items[index].Orderpriority = 2;
                _items[index].Unitprice = 0;
            }
            else
            {
                Literal litPrice = (Literal)gvr.FindControl("litPrice");
                _items[index].Item = it;
                gvr.Cells[2].Text = it.Colorname;
                gvr.Cells[4].Text = it.GetUnitPrice(UserHelper.DatabaseCode).ToString("N0");
                _items[index].Orderqty = int.Parse(txtOrderQty.Text);
                _items[index].Orderpriority = int.Parse(dropPriority.SelectedValue);
                _items[index].Unitprice = it.GetUnitPrice(UserHelper.DatabaseCode);
                litPrice.Text = _items[index].Price.ToString("N0");
            }

            CalculateTotal(gvMain);
            //BindData();
        }
    }
示例#36
0
    protected void btnGrid1DelSel_Click(object sender, EventArgs e)//删除选中记录
    {
        try
        {
            //    createGridView();
            for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
            {
                if (((CheckBox)GridView1.Rows[i].FindControl("ck")).Checked)
                {
                    string      section_code = GridView1.DataKeys[i].Values[0].ToString();
                    string      para_code    = GridView1.DataKeys[i].Values[1].ToString();
                    GridViewRow row          = GridView1.Rows[i];

                    string query            = "delete from  ht_inner_report_contrast   where section_code = '" + section_code + "' and seg_name = '" + ((DropDownList)row.FindControl("listSeg")).SelectedValue + "' and para_code = '" + para_code + "'";
                    MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator();
                    string log_message      = opt.UpDateOra(query) == "Success" ? "删除报表字段成功" : "删除报表字段失败";
                    log_message += "--标识:" + section_code + para_code;
                    InsertTlog(log_message);
                }
            }
            bindGrid();
        }
        catch (Exception ee)
        {
            Response.Write(ee.Message);
        }
    }
示例#37
0
 private void SetLinkButton(GridViewRow gvr, string id, bool enabled)
 {
     LinkButton linkButton = (LinkButton)gvr.FindControl(id);
     linkButton.Enabled = enabled && !isExport;
 }
示例#38
0
        protected void btn_confirm_Click(object sender, EventArgs e)
        {
            string userid = Session["UserID"].ToString();

            if (userid == LabelDocumentid.Text)
            {
                string        sqltext     = "";
                List <string> sqltextlist = new List <string>();
                string        orderno     = gloabsheetno;
                string        ptcode      = "";
                string        note        = "";
                int           temp        = confsavemess();
                if (temp == 0 || temp == 1)
                {
                    for (int i = 0; i < GridView1.Rows.Count; i++)
                    {
                        GridViewRow gr  = GridView1.Rows[i];
                        CheckBox    cbk = (CheckBox)gr.FindControl("CheckBox1");
                        if (cbk.Checked)
                        {
                            ptcode = ((Label)gr.FindControl("PlanCode")).Text;
                            note   = ((TextBox)gr.FindControl("tb_value")).Text;
                            if (note.ToString().Trim() == "")
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('关闭原因不能为空!');", true);
                            }
                            else
                            {
                                sqltext = "update TBPC_PURORDERDETAIL set PO_CSTATE='1',PO_NOTE='" + note + "' WHERE PO_CODE='" + orderno + "' and PO_PTCODE='" + ptcode + "'";
                                DBCallCommon.ExeSqlText(sqltext);
                            }
                        }
                    }
                    sqltext = "SELECT PO_ID FROM TBPC_PURORDERDETAIL WHERE PO_CODE='" + orderno + "' and PO_CSTATE='0'";    //是否还存在未关闭的,如果都关闭则整单关闭
                    DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext);
                    if (dt.Rows.Count == 0)
                    {
                        sqltext = "update TBPC_PURORDERTOTAL set PO_CSTATE='1',PO_ZJE='0'  WHERE PO_CODE='" + orderno + "'";    //单号关闭
                        DBCallCommon.ExeSqlText(sqltext);
                    }
                    else
                    {
                        double zje = 0;
                        sqltext = "select sum(ctamount) as zje from View_TBPC_PURORDERDETAIL_PLAN where orderno='" + LabelCode.Text + "' and  detailcstate!='1'";
                        DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sqltext);
                        if (dt1.Rows.Count > 0)
                        {
                            zje = Convert.ToDouble(dt1.Rows[0]["zje"].ToString());
                        }
                        sqltext = "UPDATE TBPC_PURORDERTOTAL SET PO_ZJE=" + zje + "  WHERE PO_CODE='" + LabelCode.Text.ToString() + "'";
                        DBCallCommon.ExeSqlText(sqltext);
                    }

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('操作成功!');window.close();", true);
                }
                else if (temp == 2)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您未选择数据,本次操作无效!');", true);
                }
                else if (temp == 3)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('选择了已入库的数据,本次操作无效!');", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您无权进行操作!');", true);
            }
        }
示例#39
0
 private Visualization_GoodsTraceability_Traceability_View GetOrderViewControl(GridViewRow gvr)
 {
     return (Visualization_GoodsTraceability_Traceability_View)gvr.FindControl("ucView");
 }
示例#40
0
        //判断是否选择数据
        protected int isselected()
        {
            gloabcode = "";
            int count = 0;
            int j     = 0;
            int temp  = 0;
            int k     = 0;
            int a     = 0;

            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                GridViewRow gr = GridView1.Rows[i];
                System.Web.UI.WebControls.CheckBox cbk = (System.Web.UI.WebControls.CheckBox)gr.FindControl("CheckBox1");
                if (cbk.Checked)
                {
                    count++;
                    string ptcode            = ((System.Web.UI.WebControls.Label)gr.FindControl("PlanCode")).Text;
                    string sql               = "select * from TBPC_MARSTOUSEALL where PUR_PTCODE='" + ptcode + "'";
                    System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sql);
                    if (dt.Rows.Count > 0)
                    {
                        j++;
                    }
                    sql = "select PUR_PCODE from TBPC_PURCHASEPLAN where PUR_PTCODE='" + ptcode + "'";
                    System.Data.DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sql);
                    if (dt1.Rows.Count > 0)
                    {
                        if (gloabcode != dt1.Rows[0]["PUR_PCODE"].ToString())
                        {
                            k++;
                        }
                        gloabcode = dt1.Rows[0]["PUR_PCODE"].ToString();
                    }
                    string cstate = ((System.Web.UI.WebControls.Label)gr.FindControl("cstate")).Text;
                    if (cstate == "0")
                    {
                        a++;
                    }
                }
            }
            if (count == 0)//没选择数据
            {
                temp = 1;
            }
            else if (j > 0)//已经插入的数据
            {
                temp = 2;
            }
            else if (k > 1)
            {
                temp = 3;
            }
            else if (a > 0)
            {
                temp = 4;
            }
            else
            {
                temp = 0;
            }
            return(temp);
        }
 private void SetVisibilityForReIssueButton(GridViewRow currentRow, bool visibility)
 {   
     if (currentRow.FindControl("lnkReIssue") != null)
     {
         currentRow.FindControl("lnkReIssue").Visible = visibility;
     }
 }
示例#42
0
        protected void gvrBitacoraPLD_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Desbloquear")
            {
                GridViewRow row        = (GridViewRow)(sender as Control).Parent.Parent;
                int         NoBitacora = row.RowIndex;

                Label lblClave             = (Label)row.FindControl("lblClave");
                Label lblSistema           = (Label)row.FindControl("lblSistema");
                Label lblSucursal          = (Label)row.FindControl("lblSucursal");
                Label lblUsuario           = (Label)row.FindControl("lblUsuario");
                Label lblCliente           = (Label)row.FindControl("lblCliente");
                Label lblPersonaIncidencia = (Label)row.FindControl("lblPersonaIncidencia");
                Label lblRelCliente        = (Label)row.FindControl("lblRelCliente");
                Label lblVCHDQEQ           = (Label)row.FindControl("lblVCHDQEQ");
                Label lbltipoLista         = (Label)row.FindControl("lblTipoLista");

                int    Clave         = Int32.Parse(lblClave.Text);
                int    sistema       = Convert.ToInt32(lblSistema.Text);
                string sucursal      = lblSucursal.Text;
                string usuario       = lblUsuario.Text;
                string cliente       = lblCliente.Text;
                string perIncidencia = lblPersonaIncidencia.Text;
                string relCliente    = lblRelCliente.Text;
                string VCHDQEQ       = lblVCHDQEQ.Text;
                string tipoLista     = lbltipoLista.Text;
                string observaciones = txtComentario.Text;
                bool   bloqPersona   = chkDesbloqProceso.Checked;
                bool   bloqUsuario   = chkDesbloqUsuario.Checked;

                ServiceResult resultBitacora = new ServiceResult();
                BIM.PLD.Website.BitacoraPLDServices.BitacoraPLD oBitacoraPLD = new BIM.PLD.Website.BitacoraPLDServices.BitacoraPLD();
                {
                    oBitacoraPLD.intBitacoraID        = Clave;
                    oBitacoraPLD.intSistema           = sistema;
                    oBitacoraPLD.vchSucursal          = sucursal;
                    oBitacoraPLD.vchUsuario           = usuario;
                    oBitacoraPLD.vchCliente           = cliente;
                    oBitacoraPLD.vchPersonaIncidencia = perIncidencia;
                    oBitacoraPLD.vchRelacionCliente   = relCliente;
                    oBitacoraPLD.vchidqeq             = VCHDQEQ;
                    oBitacoraPLD.vchComentario        = observaciones;
                    oBitacoraPLD.bitAutorizaProc      = bloqUsuario;

                    //BitacoraID = (int)getValorResult(rsBitacoraPLDService.editarBitacoraPLD(oBitacoraPLD));
                    ServiceResult result = rsBitacoraPLDService.editarBitacoraPLD(oBitacoraPLD);
                    //resultado = (int)result.ResultValue > 0 ? true : false;

                    this.wucMensajeSistema.setMensaje("La operación se ha realizado exitosamente.", 1);
                    gvrBitacoraPLD.EditIndex = -1;
                }
            }
            //else if (btn.CommandName == "ACTUALIZAR")
            //{

            //    GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent;
            //    int Clave = Convert.ToInt32(gvrBitacoraPLD.DataKeys[gvRow.RowIndex].Value);

            //    String _sistema = gvrBitacoraPLD.Rows[gvRow.RowIndex].Cells[1].Text;
            //    String _sucursal = Convert.ToString(gvrBitacoraPLD.Rows[gvRow.RowIndex].Cells[2].Text);
            //    String _usuario = gvrBitacoraPLD.Rows[gvRow.RowIndex].Cells[3].Text;
            //    String _cliente = gvrBitacoraPLD.Rows[gvRow.RowIndex].Cells[4].Text;


            //    CargarDatosBitacora(_sistema, _sucursal, _usuario, _cliente);

            //}

            #region codAnt

            //Button btn = (Button)sender;
            //if (btn.CommandName == "Update")
            //{
            //    GridViewRow row = (GridViewRow)(sender as Control).Parent.Parent;
            //    int NoPAC2 = Convert.ToInt32(gvrBitacoraPLD.DataKeys[row.RowIndex].Value);

            //    Label lblClave = row.FindControl("lblClave") as Label;
            //    Label lblVCHDQEQ = row.FindControl("lblVCHDQEQ") as Label;
            //    Label lblUsuario = row.FindControl("lblUsuario") as Label;
            //    Label lblSucursal = row.FindControl("lblSucursal") as Label;
            //    Label lblSistema = row.FindControl("lblSistema") as Label;
            //    Label lblPersonaIncidencia = row.FindControl("lblPersonaIncidencia") as Label;
            //    Label lblNombreCompleto = row.FindControl("lblNombreCompleto") as Label;
            //    Label lblCliente = row.FindControl("lblCliente") as Label;


            //    TextBox tbxObservaciones = row.FindControl("tbxObservaciones") as TextBox;
            //    CheckBox chkBloqueoPersona = row.FindControl("chkBloqueoPersona") as CheckBox;
            //    CheckBox chkBloqueoUsuario = row.FindControl("chkBloqueoUsuario") as CheckBox;

            //    ServiceResult result = new ServiceResult();
            //    BitacoraPLD oBitacoraPLD = new BitacoraPLD();
            //    try
            //    {
            //        oBitacoraPLD.intBitacoraID = Convert.ToInt32(lblClave.Text);
            //        oBitacoraPLD.VCHIDQEQ = lblVCHDQEQ.Text;
            //        oBitacoraPLD.vchUsuario = lblUsuario.Text;
            //        oBitacoraPLD.vchSucursal = lblSucursal.Text;
            //        oBitacoraPLD.intSistema = Convert.ToInt32(lblSistema.Text);
            //        oBitacoraPLD.vchPersonaIncidencia = lblPersonaIncidencia.Text;
            //        oBitacoraPLD.vchNombre = lblNombreCompleto.Text;
            //        oBitacoraPLD.vchCliente = lblCliente.Text;

            //        oBitacoraPLD.vchComentario = tbxObservaciones.Text;
            //        oBitacoraPLD.bitDesbloqueroPersona = chkBloqueoPersona.Checked;
            //        oBitacoraPLD.bitDesbloqueoUsuario = chkBloqueoUsuario.Checked;

            //        //Id = (int)getValorResult(rsVerificadorService.editarBitacoraPLD(null, oBitacoraPLD));
            //        result = rsVerificadorService.editarBitacoraPLD(oBitacoraPLD);

            //        this.wucMensajeSistema.setMensaje("La operación se ha realizado exitosamente.", 1);
            //        gvrBitacoraPLD.EditIndex = -1;

            //        //gvrBitacoraPLD.DataBind();
            //        //_MostrarBusqueda();
            //    }
            //    catch (Exception ex)
            //    {
            //        wucMensajeSistema.setMensaje(ex.Message, 2);
            //    }
            //}
            #endregion
        }
    /// <summary>
    /// Checks page validity by verifying booking mode values
    /// </summary>
    private void CheckIfPageIsValid(GridViewRow row)
    {        
        string timeIntervalValue = ((TextBox)row.FindControl("txtTimeInterval")).Text;
        CustomValidator timeIntervalValidator = (CustomValidator)row.FindControl("timeIntervalValidator");

        //If user has entered time interval
        if (String.IsNullOrEmpty(timeIntervalValue))
        {            
            timeIntervalValidator.IsValid = false;
        }
        else
        {
            int startTimeValue = Convert.ToInt32(((DropDownList)row.FindControl("ddlStartTime")).SelectedItem.Value);
            int endTimeValue = Convert.ToInt32(((DropDownList)row.FindControl("ddlEndTime")).SelectedItem.Value);
            string endTime = ((DropDownList)row.FindControl("ddlEndTime")).SelectedItem.Text;

            TimeSpan bookingEndTimeSpan = new TimeSpan(Convert.ToDateTime(endTime).Hour, Convert.ToDateTime(endTime).Minute, 0);

            // Get today's date at booking end time
            DateTime endTimeWithInterval = DateTime.Today.Add(bookingEndTimeSpan).AddHours(Convert.ToInt32(timeIntervalValue));

            //Compare if booking end time with time interval is within today's hours
            if (DateTime.Compare(endTimeWithInterval, DateTime.Today.AddDays(1)) > 0)
            {
                timeIntervalValidator.IsValid = false;
                timeIntervalValidator.ErrorMessage = ErrorMessages.InvalidTimeInterval;
            }
        }
    }
示例#44
0
 //Assigns the right controls to global controls variables
 public void SetInputControls(GridViewRow gridViewRowData)
 {
     TextBoxName = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxName"));
     TextBoxLoginName = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxLoginName"));
     TextBoxPassword = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxPassword"));
     DropDownListRoleId = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListRoleId"));
     DropDownListTerritoryId = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListTerritory"));    
  }
示例#45
0
    protected void grvJustificativas_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "AbrirJustificativa")
        {
            try
            {
                int         index = int.Parse(e.CommandArgument.ToString());
                DataKey     keys  = grvJustificativas.DataKeys[index];
                GridViewRow row   = grvJustificativas.Rows[index];

                lblJustificativa.Text = "<b>" + ((Label)row.FindControl("lblAlterar")).Text + "</b>"
                                        + "<br/><b>" + ((Label)row.FindControl("lblPeriodoCalendario")).Text + "</b>"
                                        + "<br/><br/>" + keys.Values["fjp_justificativa"].ToString();

                ScriptManager.RegisterStartupScript(Page, typeof(Page), "AbrirJustificativa",
                                                    "$(document).ready(function() { $('#divJustificativa').dialog('option', 'title', '"
                                                    + GetGlobalResourceObject("Academico", "JustificativaPendencia.Busca.grvJustificativas.colunaJustificativa").ToString()
                                                    + "'); $('#divJustificativa').dialog('open'); });", true);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
            }
        }
        else if (e.CommandName == "Excluir")
        {
            try
            {
                int     index = int.Parse(e.CommandArgument.ToString());
                DataKey keys  = grvJustificativas.DataKeys[index];

                CLS_FechamentoJustificativaPendencia entity = new CLS_FechamentoJustificativaPendencia
                {
                    tud_id = Convert.ToInt64(keys.Values["tud_id"])
                    ,
                    cal_id = Convert.ToInt32(keys.Values["cal_id"])
                    ,
                    tpc_id = Convert.ToInt32(keys.Values["tpc_id"])
                    ,
                    fjp_id = Convert.ToInt32(keys.Values["fjp_id"])
                };
                CLS_FechamentoJustificativaPendenciaBO.GetEntity(entity);

                if (CLS_FechamentoJustificativaPendenciaBO.Excluir(entity))
                {
                    grvJustificativas.PageIndex = 0;
                    grvJustificativas.DataBind();

                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "fjp_id: " + entity.fjp_id + ", tud_id: " + entity.tud_id + ", cal_id: " + entity.cal_id + ", tpc_id: " + entity.tpc_id);
                    lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "JustificativaPendencia.Busca.SucessoExcluir").ToString(), UtilBO.TipoMensagem.Sucesso);
                }
            }
            catch (ValidationException ex)
            {
                lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "JustificativaPendencia.Busca.ErroExcluir").ToString(), UtilBO.TipoMensagem.Erro);
            }
        }
    }
示例#46
0
 //Assigns the right controls to global controls variables
 public void SetInputControls(GridViewRow gridViewRowData)
 {
     DropDownListClient = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListClient"));
     DropDownListModel = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListModel"));
     TextBoxSerial = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxSerial"));
     TextBoxDescription = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxDescription"));
     territoryId = getTerritoryIdByClient(Util.ValidateInt(DropDownListClient.AspDropDownList.SelectedValue.ToString(), 0));
     TextBoxUnitIp = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxUnitIP"));
     TextBoxCameraIp = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxCameraIP"));
     TextBoxSWVersion = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxSWVersion"));
 }
示例#47
0
    protected void gvSupDoc_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("ConfirmYes"))
        {
            GridViewRow row       = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
            int         SupDocId  = int.Parse(e.CommandArgument.ToString());
            int         RequestId = int.Parse(Request.QueryString["RequestId"]);

            loiControllerr.loi_supdoc_availibility_iu(SupDocId, RequestId, true, "");

            bindSuppDoc();
        }
        else if (e.CommandName.Equals("ConfirmNo"))
        {
            GridViewRow row                 = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
            Button      btnYes              = (Button)row.FindControl("btnYes");
            Button      btnNoConfirm        = (Button)row.FindControl("btnNoConfirm");
            Button      btnSubmitNoConfirm  = (Button)row.FindControl("btnSubmitNoConfirm");
            Button      btnCancelNoConfirm  = (Button)row.FindControl("btnCancelNoConfirm");
            TextBox     txtRemarksNoConfirm = (TextBox)row.FindControl("txtRemarksNoConfirm");
            TextBox     txtAvailibility     = (TextBox)row.FindControl("txtAvailibility");
            ImageButton imgCanceled         = (ImageButton)row.FindControl("imgCanceled");

            btnYes.Visible              = false;
            btnNoConfirm.Visible        = false;
            btnSubmitNoConfirm.Visible  = true;
            btnCancelNoConfirm.Visible  = true;
            txtRemarksNoConfirm.Visible = true;
            txtAvailibility.Visible     = false;
            imgCanceled.Visible         = false;
        }
        else if (e.CommandName.Equals("CancelConfirmNo"))
        {
            GridViewRow row                 = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
            Button      btnYes              = (Button)row.FindControl("btnYes");
            Button      btnNoConfirm        = (Button)row.FindControl("btnNoConfirm");
            Button      btnSubmitNoConfirm  = (Button)row.FindControl("btnSubmitNoConfirm");
            Button      btnCancelNoConfirm  = (Button)row.FindControl("btnCancelNoConfirm");
            TextBox     txtRemarksNoConfirm = (TextBox)row.FindControl("txtRemarksNoConfirm");
            TextBox     txtAvailibility     = (TextBox)row.FindControl("txtAvailibility");
            ImageButton imgCanceled         = (ImageButton)row.FindControl("imgCanceled");

            btnYes.Visible              = true;
            btnNoConfirm.Visible        = true;
            btnSubmitNoConfirm.Visible  = false;
            btnCancelNoConfirm.Visible  = false;
            txtRemarksNoConfirm.Visible = false;
            txtAvailibility.Visible     = false;
            imgCanceled.Visible         = false;
        }
        else if (e.CommandName.Equals("SubmitConfirmNo"))
        {
            GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
            TextBox     txtRemarksNoConfirm = (TextBox)row.FindControl("txtRemarksNoConfirm");

            if (string.IsNullOrEmpty(txtRemarksNoConfirm.Text))
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Remarks is Empty');", true);
                return;
            }

            int SupDocId  = int.Parse(e.CommandArgument.ToString());
            int RequestId = int.Parse(Request.QueryString["RequestId"]);

            loiControllerr.loi_supdoc_availibility_iu(SupDocId, RequestId, false, txtRemarksNoConfirm.Text);
            bindSuppDoc();
        }
        else if (e.CommandName.Equals("CancelAvailibility"))
        {
            GridViewRow row       = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
            int         SupDocId  = int.Parse(e.CommandArgument.ToString());
            int         RequestId = int.Parse(Request.QueryString["RequestId"]);

            loiControllerr.loi_supdoc_availibility_D(SupDocId, RequestId);
            bindSuppDoc();
        }
    }
 private void SetVisibilityForCancelButton(GridViewRow currentRow, bool visibility)
 {
     if (currentRow.FindControl("lnkEdit") != null)
     {
         currentRow.FindControl("lnkEdit").Visible = visibility;
     }
 }
示例#49
0
        protected void gvDisplayPurchaseDetail_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "RowDelete")
            {
                GridViewRow gvr      = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                int         rowIndex = gvr.RowIndex;
                int         id       = Convert.ToInt32(((Label)gvr.FindControl("ProductCode")).Text);
                DataTable   dt       = (DataTable)Session["PurchaseDetail"];

                foreach (DataRow dataRow in dt.Rows)
                {
                    if (Convert.ToInt32(dataRow["ProductCode"]) == id)
                    {
                        dataRow.Delete();
                        break;
                    }
                }
                Session["PurchaseDetail"]          = dt;
                gvDisplayPurchaseDetail.DataSource = dt;
                gvDisplayPurchaseDetail.DataBind();

                AmountCalculation();

                txtProductCode.Attributes.Add("onfocus", "this.select()");
                txtProductCode.Focus();
            }

            if (e.CommandName == "RowEdit")
            {
                GridViewRow gvr      = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                int         rowIndex = gvr.RowIndex;
                int         id       = Convert.ToInt32(((Label)gvr.FindControl("ProductCode")).Text);
                DataTable   dt       = (DataTable)Session["PurchaseDetail"];

                foreach (DataRow dataRow in dt.Rows)
                {
                    if (Convert.ToInt32(dataRow["ProductCode"]) == id)
                    {
                        objProductBiz = new ProductBiz();
                        objProduct    = new Product();
                        objProduct    = objProductBiz.AddProductForPurchase(id.ToString());

                        txtCurrentStock.Text     = objProduct.ProductStock.ToString();
                        txtProductCode.Text      = dataRow["ProductCode"].ToString();
                        txtProductName.Text      = dataRow["ProductName"].ToString();
                        txtPurchasePrice.Text    = dataRow["PurchasePrice"].ToString();
                        txtPurchaseQuantity.Text = dataRow["PurchaseQuantity"].ToString();
                        txtSalePrice.Text        = dataRow["SalePrice"].ToString();
                        txtProductTotal.Text     = dataRow["TotalAmount"].ToString();
                        break;
                    }
                }
            }

            if (gvDisplayPurchaseDetail.Rows.Count == 0)
            {
                txtProductCode.Attributes.Add("onfocus", "this.select()");
                txtProductCode.Focus();

                txtTotalPurchaseAmount.Text             = string.Empty;
                pnlAddPurchaseDetailstoGridView.Visible = false;
            }
        }
示例#50
0
    private void SetLinkButton(GridViewRow gvr, string id, string[] commandArgument, bool enabled)
    {
        LinkButton linkButton = (LinkButton)gvr.FindControl(id);
        linkButton.Enabled = enabled;
        if (enabled)
        {
            StringBuilder str = new StringBuilder();
            for (int i = 0; i < commandArgument.Length; i++)
            {
                if (i > 0)
                    str.Append(",");

                str.Append(commandArgument[i]);
            }
            linkButton.CommandArgument = str.ToString();
        }
    }
示例#51
0
    protected void QtyChanged_kre(object sender, EventArgs eventArgs)
    {
        decimal numTotal = 0;

        GridViewRow row = ((GridViewRow)((System.Web.UI.WebControls.TextBox)sender).NamingContainer);

        System.Web.UI.WebControls.TextBox debit  = (System.Web.UI.WebControls.TextBox)row.FindControl("col3");
        System.Web.UI.WebControls.TextBox kredit = (System.Web.UI.WebControls.TextBox)row.FindControl("col4");
        if (kredit.Text != "0.00")
        {
            debit.Attributes.Add("Readonly", "Readonly");
            //debit.Attributes.Add("style", "pointer-events:None;");
            kredit.Attributes.Remove("Readonly");
            //kredit.Attributes.Remove("style");
        }
        else
        {
            debit.Attributes.Remove("Readonly");
            kredit.Attributes.Add("Readonly", "Readonly");
            //kredit.Attributes.Add("style", "pointer-events:None;");
            //debit.Attributes.Remove("style");
        }

        decimal GTotal  = 0;
        decimal GTotal1 = 0;
        decimal ITotal  = 0;
        decimal Gst     = 0;

        for (int i = 0; i < grvStudentDetails.Rows.Count; i++)
        {
            String total = (grvStudentDetails.Rows[i].FindControl("col4") as System.Web.UI.WebControls.TextBox).Text;

            System.Web.UI.WebControls.TextBox jumI = (System.Web.UI.WebControls.TextBox)grvStudentDetails.FooterRow.FindControl("lblTotal2");
            if (total != "")
            {
                GTotal1 = (decimal)Convert.ToDecimal(total);
            }
            else
            {
                GTotal1 = 0;
            }
            GTotal += (decimal)Convert.ToDecimal(GTotal1);

            jumI.Text = GTotal.ToString("C").Replace("RM", "").Replace("$", "");
        }
    }
    private bool SubmitValidate(string operationCode, string remark, GridViewRow editRow)
    {
        RM rm = new RM(ResourceFile.Msg);
        PageBase page = (PageBase)this.Page;        

        //服务器端再次检查是否有 operationCode
        if (string.IsNullOrEmpty(operationCode))
        {
            page.Alert(rm["PleaseSelectOperation"]);
            return false;
        }

        //处理超长备注        
        if (remark.Length > 2000)
        {
            page.Alert(rm["ExceedMaxLength"]);
            return false;
        }

        //Remark上扩展控件的验证
        bool b = true;
        PlaceHolder PHExtendEdit = (PlaceHolder)editRow.FindControl("PHExtendEdit");
        if (PHExtendEdit != null && !string.IsNullOrEmpty(ExtendEditControlName))
        {
            if (PHExtendEdit.Controls.Count == 0) { return true; }
            UserControlBase ctrl = (UserControlBase)PHExtendEdit.Controls[0];
            if (ctrl != null) b = ctrl.ExtendMethod();
            if (!b) return false;
        }

        return true;
    }
        protected void BusinessUnit_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (Page.IsValid)
            {
                BusinessUnitReportingChild li = new BusinessUnitReportingChild();
                GridViewRow row          = BusinessUnitGridView.Rows[e.RowIndex];
                string      display      = "";
                bool        isFormFilled = true;
                try
                {
                    li.BusinessUnitID = Convert.ToInt32(BusinessUnitGridView.DataKeys[e.RowIndex].Values[0]);

                    if (((TextBox)row.FindControl("BusinessUnitCode")).Text != string.Empty)
                    {
                        li.BusinessUnitCode = Convert.ToInt32(((TextBox)row.FindControl("BusinessUnitCode")).Text);
                    }
                    else
                    {
                        display = "Business Unit Code cannot be empty";
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                        isFormFilled = false;
                    }

                    if (((TextBox)row.FindControl("BusinessUnitName")).Text != string.Empty)
                    {
                        li.BusinessUnitName = Convert.ToString(((TextBox)row.FindControl("BusinessUnitName")).Text);
                    }
                    else
                    {
                        display = "Business Unit Name cannot be empty";
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                        isFormFilled = false;
                    }

                    if (((DropDownList)row.FindControl("BusinessUnitManagerName")).SelectedValue != "Select One")
                    {
                        li.BusinessUnitManagerName = ((DropDownList)row.FindControl("BusinessUnitManagerName")).SelectedValue;
                    }
                    // else
                    // {
                    //     display = "Select Business Unit Manager Name from dropdown";
                    //     ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                    //     isFormFilled = false;
                    // }

                    if (((DropDownList)row.FindControl("CompanyName")).SelectedValue != "Select One")
                    {
                        li.CompanyName = ((DropDownList)row.FindControl("CompanyName")).SelectedValue;
                    }
                    else
                    {
                        display = "Select Company Name from dropdown";
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                        isFormFilled = false;
                    }

                    if (!String.IsNullOrEmpty(Convert.ToString((Request.Form[row.FindControl("EffectiveDate").UniqueID]))))
                    {
                        li.EffectiveDate = Convert.ToDateTime((Request.Form[row.FindControl("EffectiveDate").UniqueID]));
                    }
                    else
                    {
                        display = "Effective Date cannot be empty";
                        ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                        isFormFilled = false;
                    }
                    if (!String.IsNullOrEmpty(Convert.ToString((Request.Form[row.FindControl("ExpirationDate").UniqueID]))))
                    {
                        li.ExpirationDate = Convert.ToDateTime((Request.Form[row.FindControl("ExpirationDate").UniqueID]));
                    }
                    // else
                    // {
                    //     display = "Expiration Date cannot be empty";
                    //     ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                    //     isFormFilled = false;
                    // }
                    if (li.ExpirationDate != DateTime.MinValue)
                    {
                        if (li.ExpirationDate < li.EffectiveDate)
                        {
                            display = "Expiration Date must be after Effective date";
                            ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                            isFormFilled = false;
                        }
                    }

                    if (isFormFilled)
                    {
                        if (memberships == 1 || memberships == 2)
                        {
                            DataSet result = li.UpdateSKPickingBoard(li, memberships);

                            string res = Convert.ToString(result.Tables[0].Rows[0].ItemArray[0]);
                            if (res.Contains("Effective Date should be after"))
                            {
                                ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + res + "');", true);
                                isFormFilled = false;
                            }
                            else if (res.Contains("Expiration Date should be before"))
                            {
                                ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + res + "');", true);
                                isFormFilled = false;
                            }
                            if (res.Equals("Duplicate BusinessUnitCode"))
                            {
                                display = "BusinessUnit Code already exists in the database";
                                ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                            }
                            else if (res.Equals("Duplicate BusinessUnitName"))
                            {
                                display = "BusinessUnit Name already exists in the database";
                                ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('" + display + "');", true);
                            }
                            else if (res.Equals("Success"))
                            {
                            }
                        }
                        else
                        {
                            display = "You must be a member of Consolidated Sales Reporting – Admin or Consolidated Sales Reporting – Finance  groups to make changes.";
                            ClientScript.RegisterStartupScript(this.GetType(), "yourMessage", "alert('" + display + "');", true);
                        }
                    }
                    //if (memberships > 0)
                    //{
                    //    li.UpdateSKPickingBoard(li, memberships);
                    //}
                    //else
                    //{
                    //    string display = "You must be a member of SK_Picking _Operations or SK_Picking_Warehouse groups to make changes.";
                    //    ClientScript.RegisterStartupScript(this.GetType(), "yourMessage", "alert('" + display + "');", true);
                    //}
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                BusinessUnitGridView.EditIndex = -1;
                BindGridView();
            }
        }
    private int GetDropDownValue(GridViewRow currentRow, string controlName)
    {
        int dropDownValue = 0;
        if (currentRow.FindControl(controlName).Visible == true)
        {
            dropDownValue = Convert.ToInt32(((DropDownList)currentRow.FindControl(controlName)).SelectedItem.Value);
        }

        return dropDownValue;
    }
示例#55
0
 protected void gvCarrito_RowComand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "editItem")
         {
             GridViewRow row           = (GridViewRow)(((System.Web.UI.WebControls.Button)e.CommandSource).NamingContainer);
             String      cantidadVenta = ((System.Web.UI.WebControls.TextBox)row.FindControl("cantidadVenta")).Text;
             if (cantidadVenta == null)
             {
                 throw new Exception("Debe especificar una cantidad");
             }
             if (cantidadVenta.Length != 0 && Convert.ToInt32(cantidadVenta) > 0)
             {
                 int idItem = Convert.ToInt32(dgvCarrito.DataKeys[Convert.ToInt32(e.CommandArgument)].Values["IdItem"].ToString());
                 if (idItem.ToString() == null)
                 {
                     throw new Exception("Acción no permitida");
                 }
                 int idAlmacen = obj.getAlmacenByVendedor(1);
                 int salida    = obj.updateCantidad(Convert.ToInt32(Session["venta"]), idAlmacen, idItem, Convert.ToInt32(cantidadVenta));
                 if (salida != 0)
                 {
                     int idMarca = Convert.ToInt32(ddlMarca.SelectedValue);
                     int idTipo  = Convert.ToInt32(ddlTipo.SelectedValue);
                     dgvItems.DataSource = obj.getItemsByNombre(Text7.Value, idMarca, idTipo);
                     dgvItems.DataBind();
                     ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "Notificacion('Ok','Se actualizó correctamente la cantidad','success')", true);
                 }
                 else
                 {
                     throw new Exception("La cantidad sobrepasa el stock");
                 }
             }
             else
             {
                 throw new Exception("La cantidad debe ser mayor a 0");
             }
         }
         else if (e.CommandName == "deleteItem")
         {
             int idItem = Convert.ToInt32(dgvCarrito.DataKeys[Convert.ToInt32(e.CommandArgument)].Values["IdItem"].ToString());
             if (idItem.ToString() == null)
             {
                 throw new Exception("Acción no permitida");
             }
             int       idAlmacen  = obj.getAlmacenByVendedor(1);
             DataTable ventaXItem = obj.deleteItemxVenta(Convert.ToInt32(Session["venta"]), idAlmacen, idItem);
             dgvCarrito.DataSource = ventaXItem;
             dgvCarrito.DataBind();
             if (ventaXItem.Rows.Count == 0)
             {
                 obj.deleteVenta(Convert.ToInt32(Session["venta"]), idAlmacen);
                 buildTableVentasPendientes();
                 int idMarca = Convert.ToInt32(ddlMarca.SelectedValue);
                 int idTipo  = Convert.ToInt32(ddlTipo.SelectedValue);
                 dgvItems.DataSource = obj.getItemsByNombre(Text7.Value, idMarca, idTipo);
                 dgvItems.DataBind();
                 Session["venta"] = null;
                 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "Notificacion('Ok','Se eliminó correctamente la venta','success')", true);
                 tituloVenta.InnerText = "";
             }
             int idMarcaCombo = Convert.ToInt32(ddlMarca.SelectedValue);
             int idTipoCombo  = Convert.ToInt32(ddlTipo.SelectedValue);
             dgvItems.DataSource = obj.getItemsByNombre(Text7.Value, idMarcaCombo, idTipoCombo);
             dgvItems.DataBind();
         }
         buildTableVentasPendientes();
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "Notificacion('Error','" + ex.Message + "','error')", true);
     }
 }
 private string GetHuId(GridViewRow gvr)
 {
     return ((Label)gvr.FindControl("lblHuId")).Text;
 }
示例#57
0
        protected void gridFADN1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            gridFADN1.Columns[0].Visible = true;
            int         index = int.Parse(e.CommandArgument.ToString());
            GridViewRow row   = gridFADN1.Rows[index];
            DataTable   data  = new DataTable();

            if (e.CommandName == "Nuevo")
            {
                (row.FindControl("nuevoP3") as LinkButton).Visible       = false;
                (row.FindControl("crearP3") as LinkButton).Visible       = true;
                (row.FindControl("cancelCrearP3") as LinkButton).Visible = true;
            }

            if (e.CommandName == "CrearP3")
            {
                try
                {
                    modelo.codigo      = (row.FindControl("lblCodigo") as Label).Text;
                    modelo.promocion   = Convert.ToDouble((row.FindControl("TxtPromocion") as TextBox).Text);
                    modelo.programa    = Convert.ToDouble((row.FindControl("TxtPrograma") as TextBox).Text);
                    modelo.actividad   = Convert.ToDouble((row.FindControl("TxtActividad") as TextBox).Text);
                    modelo.otra_fuente = Convert.ToDouble((row.FindControl("TxtOtraFuente") as TextBox).Text);
                    modelo.subtoltal   = Convert.ToDouble((row.FindControl("TxtPromocion") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtPrograma") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtActividad") as TextBox).Text);
                    modelo.total       = Convert.ToDouble((row.FindControl("TxtPromocion") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtPrograma") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtActividad") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtOtraFuente") as TextBox).Text);
                    modelo.fadn        = Session["Federacion"].ToString();
                    modelo.ano         = year;
                    modelo.fkestado    = 1;

                    pat.P3Create(modelo);
                    CargarGrid();
                    ScriptManager.RegisterStartupScript(this, typeof(string), "Mensaje", "swal('¡Completo!', 'La información fue ingresada', 'success');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, typeof(string), "Mensaje", "swal('¡Error!', 'La información no fue ingresada', 'error');", true);
                }
            }

            if (e.CommandName == "CancelarCrearP3")
            {
                CargarGrid();
            }

            if (e.CommandName == "EditarP3")
            {
                try
                {
                    modelo.promocion   = Convert.ToDouble((row.FindControl("TxtPromocion") as TextBox).Text);
                    modelo.programa    = Convert.ToDouble((row.FindControl("TxtPrograma") as TextBox).Text);
                    modelo.actividad   = Convert.ToDouble((row.FindControl("TxtActividad") as TextBox).Text);
                    modelo.otra_fuente = Convert.ToDouble((row.FindControl("TxtOtraFuente") as TextBox).Text);
                    modelo.subtoltal   = Convert.ToDouble((row.FindControl("TxtPromocion") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtPrograma") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtActividad") as TextBox).Text);
                    modelo.total       = Convert.ToDouble((row.FindControl("TxtPromocion") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtPrograma") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtActividad") as TextBox).Text) + Convert.ToDouble((row.FindControl("TxtOtraFuente") as TextBox).Text);

                    pat.P3Update(modelo, int.Parse(row.Cells[0].Text), 0);
                    CargarGrid();
                    ScriptManager.RegisterStartupScript(this, typeof(string), "Mensaje", "swal('¡Completo!', 'La información fue modificada', 'success');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, typeof(string), "Mensaje", "swal('¡Error!', 'La información no fue modificada', 'error');", true);
                }
            }

            if (e.CommandName == "cancelEditP3")
            {
                CargarGrid();
            }

            if (e.CommandName == "Editar")
            {
                switch (Session["Rol"].ToString())
                {
                case "Usuario Interno de FADN":
                    (row.FindControl("TxtPromocion") as TextBox).Enabled  = true;
                    (row.FindControl("TxtPrograma") as TextBox).Enabled   = true;
                    (row.FindControl("TxtActividad") as TextBox).Enabled  = true;
                    (row.FindControl("TxtOtraFuente") as TextBox).Enabled = true;

                    (row.FindControl("nuevoP3") as LinkButton).Visible      = false;
                    (row.FindControl("btEditar") as LinkButton).Visible     = false;
                    (row.FindControl("editP3") as LinkButton).Visible       = true;
                    (row.FindControl("cancelEditP3") as LinkButton).Visible = true;
                    break;

                case "Técnico Evaluación":
                    data = obs.observacionMostrarAcompaniamiento(int.Parse(row.Cells[0].Text), 23);

                    for (int i = 0; i < data.Rows.Count; i++)
                    {
                        idIntroObservacionSinRechazo.Text   = data.Rows[i][0].ToString();
                        txtCrearObservacionSinRechazo.Value = data.Rows[i][1].ToString();
                    }

                    idIntroObservacionSinRechazo.Visible  = false;
                    crearObservacionSinRechazo.Visible    = true;
                    btObservacionSinRechazoUpdate.Visible = true;
                    break;
                }
            }
            if (e.CommandName == "Mostrar")
            {
                listObservacionesFADN.DataSource            = obs.observacionMostrarFADN(int.Parse(row.Cells[0].Text), 23);
                listObservacionesAcompaniamiento.DataSource = obs.observacionMostrarAcompaniamiento(int.Parse(row.Cells[0].Text), 23);
                listObservacionesEvaluacion.DataSource      = obs.observacionMostrarEvaluador(int.Parse(row.Cells[0].Text), 23);

                listObservacionesFADN.DataBind();
                listObservacionesAcompaniamiento.DataBind();
                listObservacionesEvaluacion.DataBind();

                mostrarObservacion.Visible = true;
            }
            if (e.CommandName == "Observacion")
            {
                switch (Session["Rol"].ToString())
                {
                case "Usuario CE de FADN":
                    idIntroObservacionRechazo.Text    = row.Cells[0].Text;
                    idIntroObservacionRechazo.Visible = false;
                    crearObservacionRechazo.Visible   = true;
                    btcrearObservacionRechazo.Visible = true;
                    break;

                case "Técnico Acompañamiento":
                    idIntroObservacionSinRechazo.Text    = row.Cells[0].Text;
                    idIntroObservacionSinRechazo.Visible = false;
                    crearObservacionSinRechazo.Visible   = true;
                    btObservacionSinRechazo.Visible      = true;
                    break;

                case "Técnico Evaluación":
                    idIntroObservacionRechazo.Text    = row.Cells[0].Text;
                    idIntroObservacionRechazo.Visible = false;
                    crearObservacionRechazo.Visible   = true;
                    guardarObservacionRechazo.Visible = true;
                    btcrearObservacionRechazo.Visible = true;
                    break;
                }
            }
            if (e.CommandName == "Aprobar")
            {
                switch (Session["Rol"].ToString())
                {
                case "Usuario CE de FADN":
                    obseracion.id22    = int.Parse(row.Cells[0].Text);
                    obseracion.usuario = id.idUsuario(Convert.ToString(Session["Usuario"]));
                    obs.observacionCreateFADN(obseracion);
                    pat.P3Update(modelo, int.Parse(row.Cells[0].Text), 6);
                    break;

                case "Técnico Evaluación":
                    obseracion.id22    = int.Parse(row.Cells[0].Text);
                    obseracion.usuario = id.idUsuario(Convert.ToString(Session["Usuario"]));
                    obs.observacionCreateEvaluador(obseracion);
                    pat.P3Update(modelo, int.Parse(row.Cells[0].Text), 13);
                    break;
                }
                CargarGrid();
            }
            if (e.CommandName == "Enviar")
            {
                switch (Session["Rol"].ToString())
                {
                case "Usuario Interno de FADN":
                    pat.P3Update(modelo, int.Parse(row.Cells[0].Text), 3);
                    break;

                case "Técnico Acompañamiento":
                    obseracion.id22    = int.Parse(row.Cells[0].Text);
                    obseracion.usuario = id.idUsuario(Convert.ToString(Session["Usuario"]));
                    obs.observacionCreateAcompaniamiento(obseracion);
                    pat.P3Update(modelo, int.Parse(row.Cells[0].Text), 9);
                    break;
                }

                CargarGrid();
            }
            if (e.CommandName == "Eliminar")
            {
                pat.P3Update(modelo, int.Parse(row.Cells[0].Text), 12);
                CargarGrid();
            }
            gridFADN1.Columns[0].Visible = false;
        }
示例#58
0
 //Assigns the right controls to global controls variables
 public void SetInputControls(GridViewRow gridViewRowData)
 {
     TextBoxName = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxName"));
 }
        /// <summary>
        /// Row Command capture for gvRegionPriceTrack GridView
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvRegionPriceTrack_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string Issues = string.Empty;

            try
            {
                //Edit, Update, Delete, User
                string      s = String.Empty;
                CheckBox    chk;
                Label       Lbl;
                TextBox     txt;
                string      cname  = e.CommandName.ToString();
                int         RowID  = Convert.ToInt32(e.CommandArgument);
                GridViewRow r      = gvRegionPriceTrack.Rows[RowID];
                DataRowView rv     = (DataRowView)r.DataItem;
                DateTime    BDate  = DateTime.Now;
                string      sBDate = BDate.ToString("MM/dd/yyyy");
                Lbl = (Label)r.FindControl("lblRegPTID");
                int ID = Convert.ToInt32(Lbl.Text);
                Lbl = (Label)r.FindControl("lblRegPTSpecie");
                string Specie = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTThick");
                string Thickness = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTGrade");
                string Grade = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTRegion");
                string Reg = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTProduct");
                string Prod = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTProdDesc");
                string ProdDesc = Lbl.Text;
                txt = (TextBox)r.FindControl("txtRegPTComment");
                string      CommentPM = txt.Text;
                HiddenField hf        = (HiddenField)r.FindControl("hfProdID");
                string      ProdID    = hf.Value;

                //Lbl = (Label)r.FindControl("lblRegPTCommentReg");
                //string CommentReg = Lbl.Text;
                txt = (TextBox)r.FindControl("txtRegPTPrice");
                string sPrice = txt.Text;
                s = txt.Text.Replace("$", "");
                s = s.Replace(",", "");
                if (s == "")
                {
                    s = "0";
                }
                double Price   = Convert.ToDouble(s);
                int    Mngd    = 0;
                int    Tracked = 0;
                chk = (CheckBox)r.FindControl("chkRegPTManaged");
                if (chk.Checked == true)
                {
                    Tracked = 1;
                    Mngd    = 1;
                }

                Lbl = (Label)r.FindControl("lblRegPTProdLen");
                string Len = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTProdColor");
                string Color = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTProdSort");
                string Sort = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTProdMilling");
                string Milling = Lbl.Text;
                Lbl = (Label)r.FindControl("lblRegPTProdNoPrint");
                string NoPrint = Lbl.Text;

                //Cells: 0-AppAreaU, 1-GroupUserID, 2-UserGroup, 3-FullUserName, 4-sRightLevel, 5-sBeginDate, 6-sEndDate, 7-btnEditRight/btnDelRight/btnEditUser, 8-UserLastName, 9-UserFirstName, 10-UserMiddleName
                //       11-EmailAddress, 12-EmpPosition, 13-RightLevel, 14-UserGroupCode, 15-UserGroupID, 16-UserLogin, 17-sActive, 18-sContractor, 19-UserID, 20-EmpID
                switch (cname)
                {
                //case "PriceEdit":
                //	break;
                //case "CommentEdit":
                //	break;
                case "Edit1":
                    try
                    {
                        this.divItemEdit.Style["display"] = "block";
                        this.lblCatDataIDE.Text           = ID.ToString();
                        this.txtProductE.Text             = Prod;
                        this.txtProdDescE.Text            = ProdDesc;
                        this.ddlIsManagedE.SelectedValue  = Mngd.ToString();
                        this.ddlIsTrackedE.SelectedValue  = Tracked.ToString();
                    }
                    catch (HttpException hex)
                    {
                        this.lblErrorMsg.Text = hex.Message;
                    }

                    try
                    { this.ddlItemColorE.SelectedValue = Color; }
                    catch (Exception e1)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e1.Message;
                    }
                    try
                    { this.ddlItemGradeE.SelectedValue = Grade; }
                    catch (Exception e2)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e2.Message;
                    }
                    try
                    { this.ddlItemLengthE.SelectedValue = Len; }
                    catch (Exception e3)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e3.Message;
                    }
                    try
                    {
                        this.ddlItemMillingE.SelectedValue = Milling;
                    }
                    catch (Exception e4)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e4.Message;
                    }
                    try
                    {
                        this.ddlItemNoPrintE.SelectedValue = NoPrint;
                    }
                    catch (Exception e5)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e5.Message;
                    }
                    try
                    {
                        this.ddlItemSortE.SelectedValue = Sort;
                    }
                    catch (Exception e6)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e6.Message;
                    }
                    try
                    {
                        this.ddlItemSpeciesE.SelectedValue = Specie;
                    }
                    catch (Exception e7)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e7.Message;
                    }
                    try
                    {
                        this.ddlItemThicknessE.SelectedValue = Thickness;
                    }
                    catch (Exception e8)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e8.Message;
                    }
                    try
                    {
                        this.txtPriceE.Text           = GenUtilities.FormatToMoney(Price);
                        this.txtCommentPmE.Text       = CommentPM;
                        this.ddlRegionE.SelectedValue = Reg;
                    }
                    catch (Exception e9)
                    {
                        if (Issues.Length > 0)
                        {
                            Issues += Environment.NewLine;
                        }
                        Issues += e9.Message;
                    }
                    this.txtProductE.Focus();
                    if (Issues.Length > 0)
                    {
                        lblErrorMsg.Text = Issues;
                    }
                    this.spnAddNewRowBtn.Style["display"]  = "none";
                    this.spnSaveDataBtn.Style["display"]   = "inline";
                    this.spnCancelEditBtn.Style["display"] = "inline";
                    break;

                case "Delete1":
                    UpdateItemData(ID, 3, Reg, Prod, ProdID, ProdDesc, Price, Specie, Thickness, Grade, Len, Color, Sort, Milling, NoPrint, Tracked, Mngd, CommentPM);
                    break;

                case "New1":
                    this.lblCatDataIDE.Text       = "0";
                    this.ddlRegionE.SelectedValue = Reg;
                    if (Mngd == 1)
                    {
                        this.ddlIsManagedE.SelectedValue = "1";
                    }
                    else
                    {
                        this.ddlIsManagedE.SelectedValue = "0";
                    }
                    if (Tracked == 1)
                    {
                        this.ddlIsTrackedE.SelectedValue = "1";
                    }
                    else
                    {
                        this.ddlIsTrackedE.SelectedValue = "0";
                    }
                    this.txtProductE.Text  = Prod;
                    this.txtProdDescE.Text = ProdDesc;
                    this.txtPriceE.Text    = sPrice;
                    if (Specie == "")
                    {
                        Specie = "0";
                    }
                    if (Thickness == "")
                    {
                        Thickness = "0";
                    }
                    if (Grade == "")
                    {
                        Grade = "0";
                    }
                    if (Len == "")
                    {
                        Len = "0";
                    }
                    if (Color == "")
                    {
                        Color = "0";
                    }
                    if (Sort == "")
                    {
                        Sort = "0";
                    }
                    if (Milling == "")
                    {
                        Milling = "0";
                    }
                    if (NoPrint == "")
                    {
                        NoPrint = "0";
                    }
                    this.ddlItemSpeciesE.SelectedValue   = Specie;
                    this.ddlItemThicknessE.SelectedValue = Thickness;
                    this.ddlItemGradeE.SelectedValue     = Grade;
                    this.ddlItemLengthE.SelectedValue    = Len;
                    this.ddlItemColorE.SelectedValue     = Color;
                    this.ddlItemSortE.SelectedValue      = Sort;
                    this.ddlItemMillingE.SelectedValue   = Milling;
                    this.ddlItemNoPrintE.SelectedValue   = NoPrint;
                    this.txtCommentPmE.Text = CommentPM;
                    this.spnAddNewRowBtn.Style["display"] = "none";
                    this.spnSaveDataBtn.Style["display"]  = "inline";
                    this.btnSaveEdit.Text = "Save";
                    this.spnCancelEditBtn.Style["display"] = "inline";
                    this.divItemEdit.Style["display"]      = "block";
                    break;

                default:
                    break;
                }
                // reload data
                gvRegionPriceTrackLoad();
            }
            catch (Exception ex)
            {
                lblErrorMsg.Text = "Error accessing item data: " + ex.Message;
            }
        }