示例#1
0
    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        if (GridView1.Rows.Count > 0)
        {
            Table tbl = (Table)GridView1.Controls[0];
            GridViewRow row = new GridViewRow(1, -1, DataControlRowType.Header, DataControlRowState.Normal);
            string msg = " ";
            if (rsQty == limitQty)
                msg = "Warning: Your search result has reached the limit of the number of " + limitQty.ToString();

            TableCell th = new TableHeaderCell();
            th.ColumnSpan = 6;
            th.Text = msg;
            row.Cells.Add(th);
            TableCell thQty = new TableHeaderCell();
            thQty.Text = "Total Qty<br/>" + totalQty.ToString();
            thQty.ForeColor = System.Drawing.Color.Red;
            thQty.HorizontalAlign = HorizontalAlign.Right;
            row.Cells.Add(thQty);
            TableCell thAmt = new TableHeaderCell();
            thAmt.Text = "Total Amount<br/>" + totalAmt.ToString();
            row.Cells.Add(thAmt);
            thAmt.ForeColor = System.Drawing.Color.Red;
            thAmt.HorizontalAlign = HorizontalAlign.Right;
            TableCell th2 = new TableHeaderCell();
            th2.ColumnSpan = 8;
            th2.Text = "&nbsp";
            row.Cells.Add(th2);
            tbl.Rows.AddAt(1, row);
        }
    }
    //End:-- code changes by sumit as on 28th April for special char implentetation
    protected void grdSearchResult_SelectedIndexChanged(object sender, EventArgs e)
    {
        string gridviewvalue = grdSearchResult.SelectedDataKey.Value.ToString();
        //hiddenSiteName.Value = grdSearchResult.Selected);   //grdSearchResult[1,grdSearchResult.SelectedIndex].ToString();
        hiddenText.Value = gridviewvalue;

        GridViewRow[] rowArray = new GridViewRow[grdSearchResult.Rows.Count];
        grdSearchResult.Rows.CopyTo(rowArray, 0);

        // Iterate though the array and display the value in the first cell of the row.
        int j = -1;
        foreach (GridViewRow row in rowArray)
        {
            j++;
            if (j == grdSearchResult.SelectedIndex)
            {
                hiddenSiteName.Value = row.Cells[1].Text;
            }
        }

        if (ViewState["PageName"] != null)
        {
            Server.Transfer(Convert.ToString(ViewState["PageName"]), true);
        }
    }
示例#3
0
    private void InsertData(GridViewRow gRow)
    {
        TextBox txtBarcode = (TextBox)gRow.Cells[1].FindControl("txtNewBarcode");
        TextBox txtAbbname = (TextBox)gRow.Cells[2].FindControl("txtNewAbbname");
        TextBox txtMultiply = (TextBox)gRow.Cells[3].FindControl("txtNewMultiply");
        DropDownList cmbUnit = (DropDownList)gRow.Cells[5].FindControl("cmbNewUnit");
        TextBox txtCost = (TextBox)gRow.Cells[6].FindControl("txtNewCost");
        TextBox txtPrice = (TextBox)gRow.Cells[7].FindControl("txtNewPrice");
        CheckBox chkIsVAT = (CheckBox)gRow.Cells[8].FindControl("chkNewIsVAT");
        CheckBox chkIsDiscount = (CheckBox)gRow.Cells[9].FindControl("chkNewIsDiscount");
        TextBox txtPackSize = (TextBox)gRow.Cells[10].FindControl("txtNewPackSize");
        DropDownList cmbUnitPack = (DropDownList)gRow.Cells[11].FindControl("cmbNewUnitPack");

        ProductBarcodeData data = new ProductBarcodeData();
        data.UNITMASTER = FlowObj.GetUnitName(this.txtMasterUnit.Text);
        //data.UNITPACK = FlowObj.GetUnitName(this.txtPackSizeUint.Text);
        data.BARCODE = txtBarcode.Text.Trim();
        data.ABBNAME = txtAbbname.Text.Trim();
        data.MULTIPLY = Convert.ToDouble(txtMultiply.Text == "" ? "0" : txtMultiply.Text);
        data.UNIT = Convert.ToDouble(cmbUnit.SelectedValue);
        data.UNITPACK = Convert.ToDouble(cmbUnitPack.SelectedValue);
        data.COST = Convert.ToDouble(txtCost.Text == "" ? "0" : txtCost.Text);
        data.PRICE = Convert.ToDouble(txtPrice.Text == "" ? "0" : txtPrice.Text);
        data.ISVAT = (chkIsVAT.Checked ? "1" : "0");
        data.ISDISCOUNT = (chkIsDiscount.Checked ? "1" : "0");
        data.PACKSIZE = Convert.ToDouble(txtPackSize.Text == "" ? "0" : txtPackSize.Text);

        if (ItemObj.InsertItem(data))
        {
            this.grvItem.DataBind();
        }
        else
            Appz.ClientAlert(this, ItemObj.ErrorMessage);
    }
示例#4
0
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {

                GridView gv3 = sender as GridView;
                GridViewRow row3 = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

                Table t3 = (Table)gv3.Controls[0];

                TableCell FileDateb1 = new TableHeaderCell();
                FileDateb1.Text = "<b>Center Name:</b> " + DropDownList4.SelectedItem.Text + " | <b>Course:</b> " + DropDownList2.SelectedItem.Text + " |  <b> Period:</b> " + Convert.ToDateTime(TextBox1.Text).ToString("dd MMM, yyyy") + " to " + Convert.ToDateTime(TextBox2.Text).ToString("dd MMM, yyyy");
                FileDateb1.ColumnSpan = GridView1.Columns.Count;
                FileDateb1.Height = 50;
                FileDateb1.Font.Size = 15;
                FileDateb1.Font.Bold = true;
                row3.Cells.Add(FileDateb1);
                t3.Rows.AddAt(0, row3);
            }
        }
        catch
        {
        }
    }
示例#5
0
 public static void CellWrap(GridViewRow row, int from)
 {
     for (int i = from; i < row.Cells.Count - 1; i++)
     {
       row.Cells[i].Attributes.Add("style", "WORD-BREAK:BREAK-ALL");
     }
 }
 public static void SetSortDirectionImage(GridView gridView, GridViewRow headerRow,
 string sortExpression, SortDirection sortDirection)
 {
     int sortColumnIndex = GetSortColumnIndex(gridView, sortExpression);
     if (sortColumnIndex != -1)
     {
         AddSortImage(headerRow, sortColumnIndex, sortDirection);
     }
 }
示例#7
0
 private void NewRowDataBound(GridViewRow gRow)
 {
     //ComboSource.BuildCombo((DropDownList)gRow.Cells[3].FindControl("cmbNewProduct"), "V_PRODUCT_RETURNREQUEST", "NAME", "LOID", "NAME", "", "àÅ×Í¡", "0");
     ControlUtil.SetIntTextBox((TextBox)gRow.Cells[4].FindControl("txtNewPDQty"));
     ControlUtil.SetIntTextBox((TextBox)gRow.Cells[5].FindControl("txtNewQty"));
     ControlUtil.SetIntTextBox((TextBox)gRow.Cells[6].FindControl("txtNewUnit"));
     string script = "document.getElementById('" + ((TextBox)gRow.Cells[5].FindControl("txtNewQty")).ClientID + "').value * ";
     ((TextBox)gRow.Cells[4].FindControl("txtNewQty")).Attributes.Add("onchange", script);
 }
示例#8
0
文件: AdminList.cs 项目: solo123/AGMV
 protected void RowOnMouseOverEvent(GridViewRow row, string keyFieldName, string editPage)
 {
     if (row.RowType == DataControlRowType.DataRow)
     {
         row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ffffcc'");
         row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");
         row.Attributes.Add("onclick", "itemClick('" + editPage + "?id=" + DataBinder.Eval(row.DataItem, keyFieldName) + "')");
     }
 }
示例#9
0
文件: AdminList.cs 项目: solo123/AGMV
 protected void RowOnMouseOverEvent1(GridViewRow row, string editPage)
 {
     if (row.RowType == DataControlRowType.DataRow)
     {
         row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ffffcc'");
         row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");
         row.Attributes.Add("onclick", "itemClick(\"" + editPage + "\")");
     }
 }
示例#10
0
    public void BindGrid()
    {
        DataTable dt = getTable();
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                btnExport.Visible = true;
                grdProdData.DataSource = dt;

                //helper = new GridViewHelper(this.grdProdData);
                //helper.RegisterGroup("Group", true, true);
                //helper.GroupSummary += helper_GroupSummary;
                //helper.RegisterSummary("Quantity", SummaryOperation.Sum, "Group");
                grdProdData.DataBind();
                int Total = 0;
                foreach (GridViewRow gr in grdProdData.Rows)
                {
                    Total = Total + Convert.ToInt32(((LinkButton)gr.FindControl("lnkQuantity")).Text);
                }
                GridViewRow oGridViewRow = new GridViewRow(grdProdData.Rows.Count+1, 14, DataControlRowType.Footer, DataControlRowState.Insert);

                TableCell oTableCell = new TableCell();
                oTableCell.Text = "";
                oTableCell.HorizontalAlign = HorizontalAlign.Center;
                oGridViewRow.Cells.Add(oTableCell);

                oTableCell = new TableCell();
                oTableCell.Text = "Total:";
                oTableCell.HorizontalAlign = HorizontalAlign.Center;
                oGridViewRow.Cells.Add(oTableCell);

                oTableCell = new TableCell();
                oTableCell.Text = Total.ToString();
                oTableCell.HorizontalAlign = HorizontalAlign.Center;
                oGridViewRow.Cells.Add(oTableCell);

                oGridViewRow.Font.Bold = true;
                oGridViewRow.BackColor = System.Drawing.Color.Aqua;
                grdProdData.Controls[0].Controls.AddAt(grdProdData.Rows.Count+1, oGridViewRow);
                //grdProdData.DataBind();
            }
            else
            {
                btnExport.Visible = false;
                grdProdData.DataSource = null;
                grdProdData.DataBind();
            }
        }
        else
        {
            btnExport.Visible = false;
            grdProdData.DataSource = null;
            grdProdData.DataBind();
        }
    }
示例#11
0
 public static void ColorizeCell(GridViewRow row, int num)
 {
     if (row.Cells.Count > num)
     {
         TableCell cell = row.Cells[num];
         cell.ForeColor =
             (!string.IsNullOrEmpty(cell.Text) && cell.Text[0] == '-') ?
                                                             Color.Red : Color.Green;
     }
 }
示例#12
0
文件: Bom.aspx.cs 项目: SoftSuite/ABB
    private void txtBarcode_TextChanged(TextBox txtBarcode, GridViewRow gRow, string cmbMaterialName, string lblProductTypeName, string txtUnitName, string lblUnitName)
    {
        DropDownList cmbMaterial = (DropDownList)gRow.Cells[indexMATERIAL].FindControl(cmbMaterialName);
        Label lblProductType = (Label)gRow.Cells[indexPRODUCTTYPE].FindControl(lblProductTypeName);
        TextBox txtUnit = (TextBox)gRow.Cells[indexUNIT].FindControl(txtUnitName);
        Label lblUnit = (Label)gRow.Cells[indexUNIT].FindControl(lblUnitName);

        BomProductData data = FlowObj.GetProductData(0, txtBarcode.Text.Trim());
        SetProductDetail(data, gRow, txtBarcode, cmbMaterial, lblProductType, txtUnit, lblUnit);
    }
示例#13
0
文件: Bom.aspx.cs 项目: SoftSuite/ABB
    private void cmbMaterial_SelectedIndexChanged(DropDownList cmbMaterial, GridViewRow gRow, string txtBarcodeName, string lblProductTypeName, string txtUnitName, string lblUnitName)
    {
        TextBox txtBarcode = (TextBox)gRow.Cells[indexBARCODE].FindControl(txtBarcodeName);
        Label lblProductType = (Label)gRow.Cells[indexPRODUCTTYPE].FindControl(lblProductTypeName);
        TextBox txtUnit = (TextBox)gRow.Cells[indexUNIT].FindControl(txtUnitName);
        Label lblUnit = (Label)gRow.Cells[indexUNIT].FindControl(lblUnitName);

        BomProductData data = FlowObj.GetProductData(Convert.ToDouble(cmbMaterial.SelectedItem.Value), "");
        SetProductDetail(data, gRow, txtBarcode, cmbMaterial, lblProductType, txtUnit, lblUnit);
    }
示例#14
0
文件: UGridView.cs 项目: qq5013/JXNG
    private void DrawHeader(object sender)
    {
        GridView grd = (GridView)sender;
        if (grd.Rows.Count > 0) return; //有数据,不要处理
        GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
        foreach (DataControlField field in grd.Columns)
        {
            TableCell cell = new TableCell();
            cell.Text = field.HeaderText;
            cell.Width = field.HeaderStyle.Width;
            cell.Height = field.HeaderStyle.Height;
            cell.ForeColor = field.HeaderStyle.ForeColor;
            cell.Font.Size = field.HeaderStyle.Font.Size;
            cell.Font.Bold = field.HeaderStyle.Font.Bold;
            cell.Font.Name = field.HeaderStyle.Font.Name;
            cell.Font.Strikeout = field.HeaderStyle.Font.Strikeout;
            cell.Font.Underline = field.HeaderStyle.Font.Underline;
            cell.BackColor = field.HeaderStyle.BackColor;
            cell.VerticalAlign = field.HeaderStyle.VerticalAlign;
            cell.HorizontalAlign = field.HeaderStyle.HorizontalAlign;
            //cell.CssClass = field.HeaderStyle.CssClass;
            cell.BorderColor = field.HeaderStyle.BorderColor;
            cell.BorderStyle = field.HeaderStyle.BorderStyle;
            cell.BorderWidth = field.HeaderStyle.BorderWidth;
            cell.Visible = field.Visible;
            row.Cells.Add(cell);
        }

        TableItemStyle headStyle = grd.HeaderStyle;
        TableItemStyle emptyStyle = grd.EmptyDataRowStyle;
        emptyStyle.Width = headStyle.Width;
        emptyStyle.Height = headStyle.Height;
        emptyStyle.ForeColor = headStyle.ForeColor;
        emptyStyle.Font.Size = headStyle.Font.Size;
        emptyStyle.Font.Bold = headStyle.Font.Bold;
        emptyStyle.Font.Name = headStyle.Font.Name;
        emptyStyle.Font.Strikeout = headStyle.Font.Strikeout;
        emptyStyle.Font.Underline = headStyle.Font.Underline;
        emptyStyle.BackColor = headStyle.BackColor;
        emptyStyle.VerticalAlign = headStyle.VerticalAlign;
        emptyStyle.HorizontalAlign = headStyle.HorizontalAlign;
        emptyStyle.CssClass = emptyStyle.CssClass;
        emptyStyle.BorderColor = headStyle.BorderColor;
        emptyStyle.BorderStyle = headStyle.BorderStyle;
        emptyStyle.BorderWidth = headStyle.BorderWidth;
        if (grd.Controls.Count == 0)
        {
            //grd.Page.Response.Write("<script language='javascript'>alert('必须在初始化表格类之前执行DataBind方法并设置EmptyDataText属性不为空!');</script>");
        }
        else
        {
            grd.Controls[0].Controls.Clear(); //删除没数据时的提示
            grd.Controls[0].Controls.AddAt(0, row);
        }
    }
示例#15
0
 public static String giatridong(GridViewRow r, String col)
 {
     //int columnIndex = 0;
     foreach (DataControlFieldCell cell in r.Cells)
     {
         if (cell.ContainingField is BoundField)
             if (((BoundField)cell.ContainingField).DataField.Equals(col))
                 return HttpUtility.HtmlDecode(cell.Text);
     }
     return "";
 }
示例#16
0
文件: Bom.aspx.cs 项目: SoftSuite/ABB
    private void SetProductDetail(BomProductData data, GridViewRow gRow, TextBox txtBarcode, DropDownList cmbMaterial, Label lblProductType, TextBox txtUnit, Label lblUnitName)
    {
        txtBarcode.Text = data.BARCODE;
        cmbMaterial.SelectedIndex = cmbMaterial.Items.IndexOf(cmbMaterial.Items.FindByValue(data.LOID.ToString()));
        lblProductType.Text = data.PRODUCTTYPENAME;
        txtUnit.Text = data.UNIT.ToString();
        lblUnitName.Text = data.UNITNAME;

        //if (txtBarcode.ID == "txtNewBarCode" && txtBarcode.Text != "")
        //    InsertData(gRow);
    }
示例#17
0
 /// <summary>
 /// 重写表头
 /// </summary>
 /// <param name="targetHeader">目标表头</param>
 /// <param name="newHeaderNames">新表头</param>
 /// <remarks>
 /// 等级#级别#上期结存 件数,重量,比例#本期调入 收购调入 件数,重量,比例#本期发出 车间投料 件数,重量,
 /// 比例#本期发出 产品外销百分比 件数,重量,比例#平均值
 /// </remarks>
 public void SplitTableHeader(GridViewRow targetHeader, string newHeaderNames)
 {
     TableCellCollection tcl = targetHeader.Cells;//获得表头元素的实例
     tcl.Clear();//清除元素
     int row = GetRowCount(newHeaderNames);
     int col = GetColCount(newHeaderNames);
     string[,] nameList = ConvertList(newHeaderNames, row, col);
     int RowSpan = 0;
     int ColSpan = 0;
     for (int k = 0; k < row; k++)
     {
         string LastFName = "";
         for (int i = 0; i < col; i++)
         {
             if (LastFName == nameList[i, k] && k != row - 1)
             {
                 LastFName = nameList[i, k];
                 continue;
             }
             else
             {
                 LastFName = nameList[i, k];
             }
             int bFlag = IsVisible(nameList, k, i, LastFName);
             switch (bFlag)
             {
                 case 0:
                     break;
                 case 1:
                     RowSpan = GetSpanRowCount(nameList, row, k, i);
                     ColSpan = GetSpanColCount(nameList, row, col, k, i);
                     tcl.Add(new TableHeaderCell());//添加表头控件
                     tcl[tcl.Count - 1].RowSpan = RowSpan;
                     tcl[tcl.Count - 1].ColumnSpan = ColSpan;
                     tcl[tcl.Count - 1].HorizontalAlign = HorizontalAlign.Center;
                     tcl[tcl.Count - 1].Text = LastFName;
                     break;
                 case -1:
                     string[] EndColName = LastFName.Split(new char[] { ',' });
                     foreach (string eName in EndColName)
                     {
                         tcl.Add(new TableHeaderCell());//添加表头控件
                         tcl[tcl.Count - 1].HorizontalAlign = HorizontalAlign.Center;
                         tcl[tcl.Count - 1].Text = eName;
                     }
                     break;
             }
         }
         if (k != row - 1)
         {//不是起始行,加入新行标签
             tcl[tcl.Count - 1].Text = tcl[tcl.Count - 1].Text + "</th>\n</tr>\n<tr>\n";
         }
     }
 }
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {

            GridView gv = sender as GridView;
            GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

            Table t = (Table)gv.Controls[0];

            TableCell cell1 = new TableHeaderCell();
            cell1.Text = "S. No";
            row.Cells.Add(cell1);

            TableCell cell2 = new TableHeaderCell();
            cell2.Text = "S. No. of Auction List";
            row.Cells.Add(cell2);

            TableCell cell3 = new TableHeaderCell();
            cell3.Text = "Bid Paper No.";
            row.Cells.Add(cell3);

            TableCell cell4 = new TableHeaderCell();
            cell4.Text = "Name of Purchaser";
            row.Cells.Add(cell4);

            TableCell cell5 = new TableHeaderCell();
            cell5.Text = "Lot No. Purchased";

            row.Cells.Add(cell5);

            TableCell cell6 = new TableHeaderCell();
            cell6.Text = "Stack No. Purchased";
            row.Cells.Add(cell6);

            TableCell cell7 = new TableHeaderCell();
            cell7.Text = "Species";
            row.Cells.Add(cell7);

            TableCell cell8 = new TableHeaderCell();
            cell8.Text = "Sizes";
            row.Cells.Add(cell8);

            TableCell cell9 = new TableHeaderCell();
            cell9.Text = "No.";
            row.Cells.Add(cell9);

            t.Rows.AddAt(0, row);

            Table t8 = (Table)gv.Controls[0];
        }
    }
 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;
 }
示例#20
0
    private void SetProductDetail(StockOutFGItemData data, GridViewRow gRow, TextBox txtBarcode, DropDownList cmbProduct, DropDownList cmbLotNo, TextBox txtUnit, Label lblUnitName, TextBox txtPrice, TextBox txtQty, TextBox txtRef)
    {
        txtBarcode.Text = data.BARCODE;
        cmbProduct.SelectedIndex = cmbProduct.Items.IndexOf(cmbProduct.Items.FindByValue(data.PRODUCT.ToString()));
        SetProductStock(cmbLotNo, data.PRODUCT);
        txtUnit.Text = data.UNIT.ToString();
        lblUnitName.Text = data.UNITNAME;
        txtPrice.Text = data.PRICE.ToString(Constz.DblFormat);
        txtQty.Text = data.QTY.ToString(Constz.IntFormat);
        txtRef.Text = data.REFLOID.ToString();

        //if (txtBarcode.ID == "txtBarcodeNew" && txtBarcode.Text != "")
        //    InsertData(gRow);
    }
    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;
    }
示例#22
0
    private void InsertData(GridViewRow gRow)
    {
        TextBox txtLowerPrice = (TextBox)gRow.Cells[1].FindControl("txtLowerPriceNew");
        TextBox txtDiscount = (TextBox)gRow.Cells[1].FindControl("txtDiscountNew");

        DiscountStepData data = new DiscountStepData();
        data.DISCOUNT = Convert.ToDouble(txtDiscount.Text == "" ? "0" : txtDiscount.Text);
        data.LOWERPRICE = Convert.ToDouble(txtLowerPrice.Text == "" ? "0" : txtLowerPrice.Text);

        if (ItemObj.InsertDiscountStep(data))
        {
            SetGrvItem();
        }
        else
            Appz.ClientAlert(this, ItemObj.ErrorMessage);
    }
示例#23
0
文件: Bom.aspx.cs 项目: SoftSuite/ABB
    private void InsertData(GridViewRow gRow)
    {
        TextBox txtBarcode = (TextBox)gRow.Cells[indexBARCODE].FindControl("txtBarcodeNew");
        DropDownList cmbMaterial = (DropDownList)gRow.Cells[indexMATERIAL].FindControl("cmbMaterialNew");
        Label lblProductType = (Label)gRow.Cells[indexPRODUCTTYPE].FindControl("txtProductTypeNew");
        TextBox txtUnit = (TextBox)gRow.Cells[indexUNIT].FindControl("txtUnitNew");
        Label lblUnit = (Label)gRow.Cells[indexUNIT].FindControl("txtUnitNameNew");
        TextBox txtMaster = (TextBox)gRow.Cells[indexMASTER].FindControl("txtMasterNew");

        if (ItemObj.InsertBomItem(txtBarcode.Text.Trim(), cmbMaterial.SelectedItem.Text, Convert.ToDouble(txtMaster.Text=="" ? "0" : txtMaster.Text), lblProductType.Text.Trim(), lblUnit.Text.Trim(), Convert.ToDouble(txtUnit.Text == "" ? "0 " : txtUnit.Text), Convert.ToDouble(cmbMaterial.SelectedItem.Value) ))
        {
            SetGrvItem();
        }
        else
            Appz.ClientAlert(this, ItemObj.ErrorMessage);
    }
示例#24
0
    private void InsertData(GridViewRow gRow)
    {
        DropDownList cmbSaleman = (DropDownList)gRow.Cells[2].FindControl("cmbSaleman");
        TextBox txtQty = (TextBox)gRow.Cells[3].FindControl("txtQty");
        PlanOrderSaleData data = new PlanOrderSaleData();
        data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text);
        data.SALEMAN = Convert.ToDouble(cmbSaleman.SelectedItem.Value);
        data.SALENAME = cmbSaleman.SelectedItem.Text;

        if (ItemObj.InsertPlanOrderSale(data))
        {
            SetGrvItem(this.lblStatus.Text);
        }
        else
            Appz.ClientAlert(this, ItemObj.ErrorMessage);
    }
示例#25
0
    private void txtBarcode_TextChanged(TextBox txtBarcode, GridViewRow gRow, string ctlProductName, string ctlLotNoName, string ctlQtyName, string ctlUnitName, string ctlUnitNameName, string ctlPriceName, string ctlRefLOIDName)
    {
        DropDownList cmbProduct = (DropDownList)gRow.Cells[3].FindControl(ctlProductName);
        DropDownList cmbLotNo = (DropDownList)gRow.Cells[4].FindControl(ctlLotNoName);
        TextBox txtQty = (TextBox)gRow.Cells[5].FindControl(ctlQtyName);
        TextBox txtUnit = (TextBox)gRow.Cells[6].FindControl(ctlUnitName);
        Label lblUnitName = (Label)gRow.Cells[6].FindControl(ctlUnitNameName);
        TextBox txtPrice = (TextBox)gRow.Cells[6].FindControl(ctlPriceName);
        TextBox txtRefLOID = (TextBox)gRow.Cells[6].FindControl(ctlRefLOIDName);

        if (FlowObj.GetReqItemProductData(Convert.ToDouble(this.txtRefLoid.Text == "" ? "0" : this.txtRefLoid.Text), txtBarcode.Text.Trim()))
        {
            StockOutFGItemData data = FlowObj.ReqItemProductData;
            SetProductDetail(data, gRow, txtBarcode, cmbProduct, cmbLotNo, txtUnit, lblUnitName, txtPrice, txtQty, txtRefLOID);
        }
    }
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            //Build custom header.
            GridView oGridView = (GridView)sender;
            GridViewRow oGridViewRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
            TableCell oTableCell = new TableCell();

            //Add Department
            oTableCell.Text = "";
            oTableCell.ColumnSpan = 1;
            oGridViewRow.Cells.Add(oTableCell);

            //Add Employee            oTableCell = new TableCell();
            oTableCell.Text = "Promise to Ship";
            oTableCell.ColumnSpan = 6;
            oGridViewRow.Cells.Add(oTableCell);

            oTableCell = new TableCell();
            oTableCell.Text = "";
            oTableCell.ColumnSpan = 2;
            oGridViewRow.Cells.Add(oTableCell);

            oTableCell = new TableCell();
            oTableCell.Text = "Unfulfilled Customer Demand";
            oTableCell.ColumnSpan = 5;
            oGridViewRow.Cells.Add(oTableCell);

            oTableCell = new TableCell();
            oTableCell.Text = "";
            oTableCell.ColumnSpan = 1;
            oGridViewRow.Cells.Add(oTableCell);

            oTableCell = new TableCell();
            oTableCell.Text = "Package Allocator";
            oTableCell.ColumnSpan = 3;
            oGridViewRow.Cells.Add(oTableCell);

            oTableCell = new TableCell();
            oTableCell.Text = "";
            oTableCell.ColumnSpan = 4;
            oGridViewRow.Cells.Add(oTableCell);

            oGridView.Controls[0].Controls.AddAt(0, oGridViewRow);
        }
    }
示例#27
0
    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;
    }
示例#28
0
    private void cmbProduct_SelectedIndexChanged(DropDownList cmbProduct, GridViewRow gRow, string ctlBarcodeName, string ctlLotNoName, string ctlQtyName, string ctlUnitName, string ctlUnitNameName, string ctlPriceName, string ctlRefLOIDName)
    {
        TextBox txtBarcode = (TextBox)gRow.Cells[2].FindControl(ctlBarcodeName);
        DropDownList cmbLotNo = (DropDownList)gRow.Cells[4].FindControl(ctlLotNoName);
        TextBox txtQty = (TextBox)gRow.Cells[6].FindControl(ctlQtyName);
        TextBox txtUnit = (TextBox)gRow.Cells[7].FindControl(ctlUnitName);
        Label lblUnitName = (Label)gRow.Cells[7].FindControl(ctlUnitNameName);
        TextBox txtPrice = (TextBox)gRow.Cells[7].FindControl(ctlPriceName);
        TextBox txtRefLOID = (TextBox)gRow.Cells[7].FindControl(ctlRefLOIDName);


        if (FlowObj.GetReqItemProductData(Convert.ToDouble(this.txtRefLoid.Text == "" ? "0" : this.txtRefLoid.Text), Convert.ToDouble(this.txtPD.Text == "" ? "0" : this.txtPD.Text), Convert.ToDouble(cmbProduct.SelectedItem.Value),this.cmbDocType.SelectedValue))
            {
                StockOutWHItemData data = FlowObj.ReqItemProductData;
                SetProductDetail(data, gRow, txtBarcode, cmbProduct, cmbLotNo, txtUnit, lblUnitName, txtPrice, txtQty, txtRefLOID);
            }
    }
    protected void gvTestTargetList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            counter += 1;

            if (counter == 41)
            {
                GridViewRow gv_row = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal);
                TableCell tc = new TableCell();
                tc.Text = @"<div style='page-break-before: always' />";
                tc.ColumnSpan = 6;
                gv_row.Cells.Add(tc);
                e.Row.Parent.Controls.AddAt(counter + 1, gv_row);
            }
        }
    }
示例#30
0
    protected void gdvFlights_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string FlightRequestId = e.CommandArgument.ToString();

        if (e.CommandName == "PrintTicket")
        {
            string url = "../DinoSales/PrintFlightTicket.aspx?frid=" + FlightRequestId;
            string s   = "window.open('" + url + "', 'popup_window', 'width=800,height=1000,left=100,top=100,resizable=yes');";
            ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
        }
        else if (e.CommandName == "GenerateTicket")
        {
            Session["returnurl"] = "../Admin/AllBookings.aspx";
            // Response.Redirect("../DinoSales/FlightEticketGenerate.aspx?frid=" + FlightRequestId);
            Response.Redirect("../DinoSales/PaymentConfirmation.aspx?frid=" + FlightRequestId);
        }
        else if (e.CommandName == "CancelTicket")
        {
            //if (Session["role_id"].ToString() == "1")
            //{
            Session["returnurl"] = "../Admin/AllBookings.aspx";
            Response.Redirect("../DinoSales/FlightCancelDetails.aspx?frid=" + FlightRequestId);
            // }
            //else
            //{
            //    objBAFlightSearch.UpdateFlightBookinngResponceStatus(Convert.ToInt32(FlightRequestId), 6);
            //    if (Request.QueryString["FileNo"] != null)
            //    {
            //        string FileNo = Request.QueryString["FileNo"];
            //        BindBookings(FileNo);
            //    }
            //}
        }
        else if (e.CommandName == "BookingCancel")
        {
            if (Session["role_id"].ToString() == "1")
            {
                GridViewRow gvr          = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                int         rowIndex     = gvr.RowIndex;
                GridViewRow row          = gdvFlightBookings.Rows[rowIndex];
                HiddenField hfBookingRef = (HiddenField)row.FindControl("hfBookingRef");
                HiddenField hfTraceId    = (HiddenField)row.FindControl("hfTraceId");
                CancelBooking(hfBookingRef.Value, Convert.ToInt32(FlightRequestId), hfTraceId.Value);
            }
            else
            {
                objBAFlightSearch.UpdateFlightBookinngResponceStatus(Convert.ToInt32(FlightRequestId), 6);
                if (Request.QueryString["FileNo"] != null)
                {
                    string FileNo = Request.QueryString["FileNo"];
                    BindBookings(FileNo);
                }
            }
        }
        else if (e.CommandName == "ViewDetails")
        {
            string url = "ShowBookinginfo.aspx?frid=" + FlightRequestId;
            string s   = "window.open('" + url + "', 'popup_window', 'width=800,height=1000,left=100,top=100,resizable=yes');";
            ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
        }
    }
示例#31
0
    protected object ugRecycleBin_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        sourceName = sourceName.ToLower();
        DataRowView data    = null;
        string      objType = null;

        switch (sourceName)
        {
        case "view":
            ImageButton imgView = ((ImageButton)sender);
            if (imgView != null)
            {
                GridViewRow gvr = (GridViewRow)parameter;
                data = (DataRowView)gvr.DataItem;
                string viewVersionUrl = ResolveUrl("~/CMSModules/Objects/Dialogs/ViewObjectVersion.aspx?showall=1&nocompare=1&versionhistoryid=" + ValidationHelper.GetInteger(data["VersionID"], 0));
                viewVersionUrl        = URLHelper.AddParameterToUrl(viewVersionUrl, "hash", QueryHelper.GetHash(viewVersionUrl));
                imgView.OnClientClick = "window.open(" + ScriptHelper.GetString(viewVersionUrl) + ");return false;";
            }
            break;

        case "destroy":
            ImageButton imgDestroy = sender as ImageButton;
            if (imgDestroy != null)
            {
                DataRowView dr = (DataRowView)(((GridViewRow)parameter).DataItem);

                objType = ValidationHelper.GetString(dr["VersionObjectType"], null);

                // Get object site name
                string siteName = null;
                if (CurrentSite != null)
                {
                    siteName = CurrentSite.SiteName;
                }
                else
                {
                    int siteId = ValidationHelper.GetInteger(dr["VersionObjectSiteID"], 0);
                    siteName = SiteInfoProvider.GetSiteName(siteId);
                }
            }
            break;

        case "restorechilds":
            ImageButton imgRestore = sender as ImageButton;
            if (imgRestore != null)
            {
                imgRestore.ImageUrl = GetImageUrl("CMSModules/CMS_RecycleBin/restorechilds.png");
            }
            break;

        case "deletedwhen":
        case "deletedwhentooltip":
            DateTime deletedWhen = ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME);
            bool     displayGMT  = (sourceName == "deletedwhentooltip");
            return(TimeZoneHelper.ConvertToUserTimeZone(deletedWhen, displayGMT, CurrentUser, CurrentSite));

        case "versionobjecttype":
            objType = ValidationHelper.GetString(parameter, "");
            return(HTMLHelper.HTMLEncode(GetString("ObjectType." + objType.Replace(".", "_"))));
        }

        return(HTMLHelper.HTMLEncode(parameter.ToString()));
    }
示例#32
0
    protected void lnkModificar_Click(object sender, EventArgs e)
    {
        try
        {
            if (!(Boolean)ViewState["actualizar"])
            {
                clsHelper.mensaje("No tiene permiso para realizar esta operación", this, clsHelper.tipoMensaje.alerta);
                return;
            }

            int         idLiquidosCorporales;
            GridViewRow r = (GridViewRow)((Control)(sender)).Parent.Parent;
            idLiquidosCorporales = int.Parse(((Label)r.FindControl("lblidLiquidosCorporales")).Text);
            ViewState["idLiquidosCorporales"] = idLiquidosCorporales;
            ClsLiquidosCorporales lc = new ClsLiquidosCorporales();
            lc = lc.seleccionarPorId(idLiquidosCorporales);

            txtFechaAalitica.Text      = clsHelper.dateFormat(lc.FechaAnalitica.ToString());
            txtLiquidoFisico.Text      = lc.liquido.ToString();
            txtAspecto.Text            = lc.aspecto.ToString();
            txtVolumen.Text            = lc.volumen.ToString();
            txtSedimiento.Text         = lc.sedimento.ToString();
            txtXantocromia.Text        = lc.xantocromia.ToString();
            txtLeucocitos.Text         = lc.leucocitos.ToString();
            txtEritocitos.Text         = lc.eritocitos.ToString();
            txtPolimorfonucleares.Text = lc.polimorfonucleares.ToString();
            txtMononucleares.Text      = lc.mononucleares.ToString();
            txtLinfocitos.Text         = lc.linfocitos.ToString();
            txtLiquidoQuimico.Text     = lc.liquidoQuimico.ToString();
            txtpH.Text               = lc.PH.ToString();
            txtGlocosa.Text          = lc.glucosa.ToString();
            txtProteinas.Text        = lc.proteinas.ToString();
            txtAlbumina.Text         = lc.albumina.ToString();
            txtLDH.Text              = lc.LDH.ToString();
            txtAmilasia.Text         = lc.amilasa.ToString();
            txtUrea.Text             = lc.urea.ToString();
            txtAcidoUrico.Text       = lc.acidoUrico.ToString();
            txtSodio.Text            = lc.sodio.ToString();
            txtPotasio.Text          = lc.potasio.ToString();
            txtCloro.Text            = lc.cloro.ToString();
            txtBicarbonato.Text      = lc.bicarbonato.ToString();
            txtIgG.Text              = lc.IgG.ToString();
            txtCK.Text               = lc.CK.ToString();
            txtLiquidoAntigenos.Text = lc.liquidoAntigenos.ToString();
            txtSifilisVDRL.Text      = lc.sifilisVDRL.ToString();
            txtSifilisTPHA.Text      = lc.sifilisTPHA.ToString();
            txteColi.Text            = lc.ecoli.ToString();
            txtDilucionVDRL.Text     = lc.dilucionVDRL.ToString();
            txtSifilisRPR.Text       = lc.sifilisRPR.ToString();
            txtSifilisRPR1.Text      = lc.sifilisRPR1.ToString();
            txtSifilisFTAABS.Text    = lc.sifilisFTAABS.ToString();
            txtsPneumoniae.Text      = lc.sPneumoniae.ToString();
            txthInfluenza.Text       = lc.hInfluenza.ToString();
            txtCryptococcus.Text     = lc.cryptococcus.ToString();
            txtDilucion1.Text        = lc.dilucion1.ToString();
            txtAda.Text              = lc.ADA.ToString();
        }
        catch (Exception ex)
        {
            clsHelper.mostrarError("lnkModificar_Click", ex, this, true);
        }
    }
示例#33
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();
        }
    }
示例#34
0
    protected void gvLane_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Insert")
        {
            TextBox txtLaneFooter = gvLane.FooterRow.FindControl("txtLanefooter") as TextBox;

            //HiddenField hiddenfieldspaceid = this.FindControl("hdnspaceid") as HiddenField;



            //int index = Convert.ToInt32(e.CommandArgument);
            //GridViewRow row = gvSetting.Rows[index];
            //HiddenField hiddenfieldspaceid = (HiddenField)row.FindControl("hdnspaceid");


            string Lanename = txtLaneFooter.Text.Trim();
            //int quantity = Convert.ToInt32(txtLaneQuantity.Text.Trim());

            int spaceid = Convert.ToInt32(ViewState["spaceid"]);

            LotSpace.insertLane(Lanename, spaceid);

            LoadSpaces(1, spaceid);
        }
        else if (e.CommandName == "AddMore")
        {
            LinkButton lnkbtnAddMoreSetting = gvLane.FooterRow.FindControl("lnkbtnAddMore") as LinkButton;
            LinkButton lnkbtnAddSetting     = gvLane.FooterRow.FindControl("lnkbtnAddSetting") as LinkButton;
            LinkButton lnkbtnCancelSetting  = gvLane.FooterRow.FindControl("lnkbtnCancelSetting") as LinkButton;


            lnkbtnAddSetting.Visible     = true;
            lnkbtnAddMoreSetting.Visible = false;
            lnkbtnCancelSetting.Visible  = true;

            TextBox txtLaneFooter = gvLane.FooterRow.FindControl("txtLanefooter") as TextBox;
            //TextBox txtSpace = gvSetting.FooterRow.FindControl("txtSpaces") as TextBox;
            txtLaneFooter.Visible = true;
        }


        else if (e.CommandName == "CancelLane")
        {
            gvLane.EditIndex = -1;
            //loadGridAndHeaderText();
            int spaceid = Convert.ToInt32(ViewState["spaceid"]);
            LoadSpaces(1, spaceid);
        }

        else if (e.CommandName == "Edit")
        {
            LaneId           = Convert.ToInt32(e.CommandArgument);
            lblErrorLot.Text = string.Empty;
        }

        else if (e.CommandName == "Delete")
        {
            int laneId = Convert.ToInt32(e.CommandArgument);
            if (!lanehaveTire(laneId))
            {
                LotSpace.deleteLane(laneId);
                int spaceid = Convert.ToInt32(ViewState["spaceid"]);
                LoadSpaces(1, spaceid);
                lblErrorLane.Text  = string.Empty;
                lblErrorLot.Text   = string.Empty;
                lblErrorSpace.Text = string.Empty;
            }
        }
        else if (e.CommandName == "LaneInfoPopUp")
        {
            ucSpaceTires.Visible        = true;
            dvpopupfacilityinfo.Visible = true;
            GridViewRow gvr          = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         RemoveAt     = gvr.RowIndex;
            Lots        objlots      = new Lots(Conversion.ParseInt(hidLotId.Value));
            LotSpace    objLotSpaces = new LotSpace(Conversion.ParseInt(e.CommandArgument));
            HiddenField lbl          = (HiddenField)gvLane.Rows[RemoveAt].FindControl("hdnspacename");

            ucSpaceTires.LoadTires(Conversion.ParseInt(e.CommandArgument));
            ucSpaceTires.LoadFacilityLotRowSpaceName(objlots.FacilityName, hidLotId.Value, objlots.LotNumber, objLotSpaces.SpaceId.ToString(), objLotSpaces.SpaceName, lbl.Value);
        }
    }
示例#35
0
        protected void CBSelect_CheckedChanged(object sender, EventArgs e)
        {
            // get row index
            GridViewRow gvRow    = (GridViewRow)(sender as Control).Parent.Parent;
            int         rowIndex = gvRow.RowIndex;

            //Get the value of column from the DataKeys using the RowIndex.
            string KdMakul = GVMakul.DataKeys[rowIndex].Values[0].ToString();
            string NIDN    = GVMakul.DataKeys[rowIndex].Values[1].ToString();
            string KELAS   = GVMakul.DataKeys[rowIndex].Values[2].ToString();

            //select Kode dan Makul
            this.LbIdProdi.Text = this.DLProdi.SelectedValue;
            this.LbKdMakul.Text = KdMakul;
            this.LbMakul.Text   = this.GVMakul.Rows[rowIndex].Cells[3].Text;
            this.LbNIDN.Text    = NIDN;
            this.LbDosen.Text   = this.GVMakul.Rows[rowIndex].Cells[6].Text;
            this.LbKelas.Text   = this.GVMakul.Rows[rowIndex].Cells[7].Text;
            this.LbJadwal.Text  = this.GVMakul.Rows[rowIndex].Cells[8].Text + "," + this.GVMakul.Rows[rowIndex].Cells[9].Text
                                  + "-" + this.GVMakul.Rows[rowIndex].Cells[10].Text + "," + this.GVMakul.Rows[rowIndex].Cells[11].Text;

            // Clear selected checkbox
            for (int i = 0; i < this.GVMakul.Rows.Count; i++)
            {
                CheckBox ch = (CheckBox)this.GVMakul.Rows[i].FindControl("CBSelect");
                ch.Checked = false;
            }

            // set label prodi
            this.LbProdi.Text = this.DLProdi.SelectedItem.Text;

            //Select Drop Down List to Default
            this.DLProdi.SelectedIndex = 0;

            //hide panel
            this.PanelMakul.Enabled = false;
            this.PanelMakul.Visible = false;

            this.PanelProdi.Enabled = true;
            this.PanelProdi.Visible = true;

            this.PanelPeserta.Enabled = false;
            this.PanelPeserta.Visible = false;

            //form validation
            if (this.LbKdMakul.Text == "" || this.LbKelas.Text == "" || this.LbNIDN.Text == "")
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('Pilih Jadwal Kuliah');", true);
                return;
            }
            string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString;

            using (SqlConnection con = new SqlConnection(CS))
            {
                con.Open();
                SqlCommand CmdMakul = new SqlCommand("SpPesertaUjian", con);
                CmdMakul.CommandType = System.Data.CommandType.StoredProcedure;

                CmdMakul.Parameters.AddWithValue("@id_prodi", this.LbIdProdi.Text);
                CmdMakul.Parameters.AddWithValue("@nidn", this.LbNIDN.Text);
                CmdMakul.Parameters.AddWithValue("@kode_makul", this.LbKdMakul.Text);
                CmdMakul.Parameters.AddWithValue("@kelas", this.LbKelas.Text);
                CmdMakul.Parameters.AddWithValue("@semester", this.DLTahun.SelectedItem.Text + this.DLSemester.SelectedItem.Text);

                DataTable TableMakul = new DataTable();
                TableMakul.Columns.Add("NPM");
                TableMakul.Columns.Add("Nama");

                using (SqlDataReader rdr = CmdMakul.ExecuteReader())
                {
                    if (rdr.HasRows)
                    {
                        this.PanelPeserta.Enabled = true;
                        this.PanelPeserta.Visible = true;

                        while (rdr.Read())
                        {
                            DataRow datarow = TableMakul.NewRow();
                            datarow["NPM"]  = rdr["npm"];
                            datarow["Nama"] = rdr["nama"];

                            TableMakul.Rows.Add(datarow);
                        }

                        //Fill Gridview
                        this.GVPeserta.DataSource = TableMakul;
                        this.GVPeserta.DataBind();
                    }
                    else
                    {
                        //clear Gridview
                        TableMakul.Rows.Clear();
                        TableMakul.Clear();
                        this.GVPeserta.DataSource = TableMakul;
                        this.GVPeserta.DataBind();

                        this.PanelPeserta.Enabled = false;
                        this.PanelPeserta.Visible = false;
                    }
                }
            }
        }
示例#36
0
    protected void btngrid1View_Click(object sender, EventArgs e)
    {
        Button      btn   = (Button)sender;
        GridViewRow row   = (GridViewRow)btn.NamingContainer;
        int         index = row.RowIndex;

        string prodcode  = GridView1.DataKeys[index].Values[0].ToString();
        string para_code = GridView1.DataKeys[index].Values[1].ToString();
        string starttime = GridView1.DataKeys[index].Values[2].ToString();
        string stoptime  = GridView1.DataKeys[index].Values[3].ToString();

        MSYS.IHAction       ihopt = new MSYS.IHAction();
        MSYS.DAL.DbOperator opt   = new MSYS.DAL.DbOperator();
        //   List<MSYS.IHAction.ParaInfo> paralist = ihopt.GetData(txtBtime.Text, txtEtime.Text, listpara.SelectedValue);
        DataTable dt = new DataTable();

        dt.Columns.Add("时间");
        dt.Columns.Add("值");
        dt.Columns.Add("状态");
        if (rdAll.Checked && listTeam.SelectedValue != "")
        {
            string  query = "select distinct g.prod_code,g.para_code, h.prod_name as 产品,j.para_name as 工艺点,k.team_name as 班组,g.b_time as 开始时间,g.e_time as 结束时间,round(g.avg,2) as 均值,g.count as 采样点数,round(g.min,2) as 最小值,round(g.max,2) as 最大值,round(g.quarate,2) as 合格率,round(g.uprate,2) as 超上限率,round(g.downrate,2) as 超下限率,round(g.stddev,2) as 标准差,round(g.absdev,2) as 绝对差,round(g.range,2) as 范围,round(g.cpk,2) as cpk  from (select distinct t.prod_code, t.para_code, t.team, t.avg, t.count, t.min, t.max, t.quarate, t.uprate, t.downrate, t.stddev, t.absdev, t.range, t.cpk, t.b_time, t.e_time from ht_qlt_data_record t where t.b_time between '" + starttime + "' and '" + stoptime + "'  and t.team = '" + listTeam.SelectedValue + "'  and t.prod_code = '" + prodcode + "'  and t.para_code = '" + para_code + "') g left join ht_pub_prod_design h on h.prod_code = g.prod_code left join ht_pub_tech_para j on j.para_code = g.para_code left join ht_sys_team k on k.team_code = g.team order by h.prod_name,j.para_name,g.e_time,k.team_name,g.count";
            DataSet data  = opt.CreateDataSetOra(query);
            if (data != null && data.Tables[0].Rows.Count > 1)
            {
                foreach (DataRow srow in data.Tables[0].Rows)
                {
                    starttime = srow["开始时间"].ToString();
                    stoptime  = srow["结束时间"].ToString();
                    MSYS.IHAction.TimeSeg        seg  = ihopt.GetTimeSegP(starttime, stoptime, para_code, prodcode);
                    List <MSYS.IHAction.ParaRes> Rows = ihopt.GetIHRealDataSet(seg);

                    foreach (MSYS.IHAction.ParaRes info in Rows)
                    {
                        var values = new object[3];
                        values[0] = info.timestamp;
                        values[1] = info.value;
                        values[2] = info.status;
                        dt.Rows.Add(values);
                    }
                }
            }
        }
        else
        {
            MSYS.IHAction.TimeSeg        seg  = ihopt.GetTimeSegP(starttime, stoptime, para_code, prodcode);
            List <MSYS.IHAction.ParaRes> Rows = ihopt.GetIHRealDataSet(seg);

            foreach (MSYS.IHAction.ParaRes info in Rows)
            {
                var values = new object[3];
                values[0] = info.timestamp;
                values[1] = info.value;
                values[2] = info.status;
                dt.Rows.Add(values);
            }
        }
        MSYS.Common.ExcelExport openXMLExcel = null;



        string basedir       = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
        string strFolderPath = basedir + @"\TEMP";

        if (!System.IO.Directory.Exists(strFolderPath))
        {
            // 目录不存在,建立目录
            System.IO.Directory.CreateDirectory(strFolderPath);
        }

        DirectoryInfo dyInfo = new DirectoryInfo(strFolderPath);

        //获取文件夹下所有的文件
        foreach (FileInfo feInfo in dyInfo.GetFiles())
        {
            //判断文件日期是否小于今天,是则删除
            if (feInfo.CreationTime < DateTime.Now.AddMinutes(-2))
            {
                feInfo.Delete();
            }
        }
        foreach (DirectoryInfo dir in dyInfo.GetDirectories())
        {
            if (dir.CreationTime < DateTime.Now.AddMinutes(-2))
            {
                dir.Delete(true);
            }
        }
        //导出文件模板所在位置
        string filename   = "在线质量统计" + System.DateTime.Now.ToString("HHmmss") + ".xls";
        String sourcePath = basedir + @"templates\在线质量统计.xls";
        String filepath   = basedir + @"TEMP\" + filename;

        try
        {
            //申明一个ExcelSaveAs对象,该对象完成将数据写入Excel的操作
            openXMLExcel = new MSYS.Common.ExcelExport(sourcePath, false);



            openXMLExcel.SetCurrentSheet(0);

            openXMLExcel.WriteData(2, 2, row.Cells[1].Text);
            openXMLExcel.WriteData(2, 6, row.Cells[0].Text);
            openXMLExcel.WriteData(3, 2, row.Cells[3].Text);
            openXMLExcel.WriteData(3, 6, row.Cells[4].Text);
            openXMLExcel.WriteData(4, 2, row.Cells[2].Text);
            openXMLExcel.WriteData(4, 6, row.Cells[6].Text);
            openXMLExcel.WriteData(6, 1, row.Cells[5].Text);
            openXMLExcel.WriteData(6, 2, row.Cells[7].Text);
            openXMLExcel.WriteData(6, 3, row.Cells[8].Text);
            openXMLExcel.WriteData(6, 4, row.Cells[9].Text);
            openXMLExcel.WriteData(6, 5, row.Cells[10].Text);
            openXMLExcel.WriteData(6, 6, row.Cells[11].Text);
            openXMLExcel.WriteData(6, 7, row.Cells[12].Text);
            openXMLExcel.WriteData(6, 8, row.Cells[13].Text);
            openXMLExcel.WriteData(6, 9, row.Cells[14].Text);
            openXMLExcel.WriteData(6, 10, row.Cells[15].Text);
            openXMLExcel.WriteDataIntoWorksheet(9, 1, dt);


            ///客户端再下载该文件,在客户端进行浏览
            FileInfo fi = new FileInfo(filepath);
            if (fi.Exists)     //判断文件是否已经存在,如果存在就删除!
            {
                fi.Delete();
            }
            openXMLExcel.SaveAs(filepath);

            openXMLExcel.Dispose();
            openXMLExcel = null;
            KillProcess("EXCEL.EXE");

            Response.Clear();
            Response.Buffer = true;

            Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8));
            Response.ContentType = "application/vnd.ms-excel";
            Response.TransmitFile(filepath);

            //  Response.End();
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
        catch (Exception ee)
        {
            if (openXMLExcel != null)
            {
                openXMLExcel.Dispose();
            }
        }
    }
示例#37
0
        protected void GridView_Hotel_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow grdrow = GridView_Hotel.SelectedRow;

            ControladorDB.Instance.Nombre_Hotel = grdrow.Cells[1].Text;
        }
示例#38
0
    /// <summary>
    /// Start of Rows Grid in Rows
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>


    protected void gvSetting_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Edit")
        {
            SpaceId = Convert.ToInt32(e.CommandArgument);
        }

        else if (e.CommandName == "Delete")
        {
            int spaceId = Convert.ToInt32(e.CommandArgument);
            if (!rowhaveTire(spaceId))
            {
                SpaceId          = Convert.ToInt32(spaceId);
                lblErrorLot.Text = string.Empty;
                LotRows.deleteSpaces(SpaceId);
                LoadRows(1);
                lblErrorLane.Text  = string.Empty;
                lblErrorLot.Text   = string.Empty;
                lblErrorSpace.Text = string.Empty;
            }
        }
        else if (e.CommandName == "AddMore")
        {
            LinkButton lnkbtnAddMoreSetting = gvSetting.FooterRow.FindControl("lnkbtnAddMore") as LinkButton;
            LinkButton lnkbtnAddSetting     = gvSetting.FooterRow.FindControl("lnkbtnAddSetting") as LinkButton;
            LinkButton lnkbtnCancelSetting  = gvSetting.FooterRow.FindControl("lnkbtnCancelSetting") as LinkButton;


            lnkbtnAddSetting.Visible     = true;
            lnkbtnAddMoreSetting.Visible = false;
            lnkbtnCancelSetting.Visible  = true;

            TextBox txtSpaceFooter = gvSetting.FooterRow.FindControl("txtSpacesfooter") as TextBox;
            //TextBox txtSpace = gvSetting.FooterRow.FindControl("txtSpaces") as TextBox;
            txtSpaceFooter.Visible = true;

            //txtSpace.Visible = true;
        }
        else if (e.CommandName == "CancelSetting")
        {
            gvSetting.EditIndex = -1;
            LoadRows(1);
        }



        else if (e.CommandName == "Insert")
        {
            TextBox txtSpaceFooter = gvSetting.FooterRow.FindControl("txtSpacesfooter") as TextBox;
            //HiddenField hiddenfieldspaceid = this.FindControl("hdnspaceid") as HiddenField;



            //int index = Convert.ToInt32(e.CommandArgument);
            //GridViewRow row = gvSetting.Rows[index];
            //HiddenField hiddenfieldspaceid = (HiddenField)row.FindControl("hdnspaceid");

            LotRows spc = new LotRows();
            spc.SpaceName   = txtSpaceFooter.Text.Trim();
            spc.IsActive    = true;
            spc.DateCreated = DateTime.Now;
            spc.Description = string.Empty;
            int temp = LotRows.insertUpdate(spc, Convert.ToInt32(hidLotId.Value));
            ViewState["spaceid"] = temp;
            //ViewState["spaceid"] = temp;

            LoadRows(1);
        }
        else if (e.CommandName == "SpaceInfoPopUp")
        {
            ucFacilitySpaces.Visible = true;


            ViewState["spaceid"] = e.CommandArgument;

            lblErrorSpace.Text          = String.Empty;
            dvpopupfacilityinfo.Visible = true;
            //pnlLot.Visible = false;
            //pnlSpace.Visible = false;
            //pnlLane.Visible = true;
            //PanelLaneValue.Visible = true;
            //addmoreLane.Visible = false;
            //gvLane.Visible = true;
            //lblfacilityForLane.Text = lblfacilityname.Text;

            //lblLotNumberLane.Text = lblLotNumberSpace.Text;
            Lots objLots = new Lots(Conversion.ParseInt(hidLotId.Value));

            GridViewRow gvr      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         RemoveAt = gvr.RowIndex;
            Label       lbl      = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename");



            ucFacilitySpaces.loadFacilityLotAndRowName(objLots.FacilityName, objLots.LotNumber, lbl.Text, Convert.ToInt32(hidLotId.Value), Conversion.ParseInt(hdnidfaclityid.Value));
            ucFacilitySpaces.loadLaneText(Convert.ToInt32(e.CommandArgument));
        }
        else if (e.CommandName == "AddSpaceLane")
        {
            ViewState["spaceid"] = e.CommandArgument;
            lblErrorLane.Text    = String.Empty;
            lblErrorLot.Text     = String.Empty;
            lblErrorSpace.Text   = String.Empty;
            pnlLot.Visible       = false;
            pnlSpace.Visible     = false;
            pnlLane.Visible      = true;
            //PanelLaneValue.Visible = true;
            //addmoreLane.Visible = false;
            //gvLane.Visible = true;
            lblfacilityForLane.Text = lblfacilityname.Text;

            lblLotNumberLane.Text = lblLotNumberSpace.Text;
            GridViewRow gvr      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         RemoveAt = gvr.RowIndex;
            Label       lbl      = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename");
            lblSpaceName.Text = lbl.Text;
            // DataSet ds = Space.GetParkingLotNumberByLotId(Convert.ToInt32(hidLotId.Value));

            // Label lbl = (Label)gvSetting.Rows[RemoveAt].FindControl("lblspacename");

            LoadSpaces(1, Convert.ToInt32(e.CommandArgument));
        }
    }
示例#39
0
        protected void GridView_Restaurante_SelectedIndexChanged1(object sender, EventArgs e)
        {
            GridViewRow grdrow = GridView_Restaurante.SelectedRow;

            ControladorDB.Instance.Nombre_Restaurante = grdrow.Cells[1].Text;
        }
示例#40
0
        private void EsercitaDelega()
        {
            GridViewRow item = null;

            //Ricerca delle delega selezionata che si vuole esercitare
            for (int i = 0; i < this.gridViewResult.Rows.Count; i++)
            {
                RadioButton rbSelection = this.gridViewResult.Rows[i].Cells[0].FindControl("rbSel") as RadioButton;
                if (rbSelection.Checked)
                {
                    item = this.gridViewResult.Rows[i];
                }
            }

            if (item != null)
            {
                DocsPaWR.InfoUtente infoUtDelegato = UserManager.GetInfoUser();
                //Imposto nuovo utente (delegante) per esercitare la delega
                DocsPaWR.UserLogin userLogin = new DocsPaWR.UserLogin();
                DocsPaWR.Utente    utente    = DelegheManager.getUtenteById(this, item.Cells[7].Text);
                userLogin.UserName          = utente.userId;
                userLogin.Password          = "";
                userLogin.IdAmministrazione = UserManager.GetInfoUser().idAmministrazione;
                userLogin.IPAddress         = this.Request.UserHostAddress;

                DocsPaWR.LoginResult loginResult;
                utente = DelegheManager.EsercitaDelega(this, userLogin, item.Cells[11].Text, item.Cells[9].Text, out loginResult);
                switch (loginResult)
                {
                case DocsPaWR.LoginResult.OK:
                    if (utente != null)
                    {
                        utente.urlWA = utils.getHttpFullPath();
                        //Memorizzo le info sul delegato che serviranno nel momento in cui
                        //si dismette la delega
                        UserManager.setDelegato(infoUtDelegato);
                        DocsPaWR.Utente utenteDelegato = UserManager.GetUserInSession();
                        DocsPaWR.Ruolo  ruoloDelegato  = RoleManager.GetRoleInSession();
                        UserManager.setUtenteDelegato(this, utenteDelegato);
                        RoleManager.setRuoloDelegato(ruoloDelegato);

                        //Nuovo utente (delegante)
                        RoleManager.SetRoleInSession(utente.ruoli[0]);
                        UIManager.RegistryManager.SetRFListInSession(UIManager.UserManager.getListaRegistriWithRF(utente.ruoli[0].systemId, "1", ""));
                        UIManager.RegistryManager.SetRegAndRFListInSession(UIManager.UserManager.getListaRegistriWithRF(utente.ruoli[0].systemId, "", ""));
                        UserManager.SetUserInSession(utente);
                        Session["ESERCITADELEGA"] = true;

                        // disconnessione utente delegante se loggato
                        LoginManager.LogOut(utente.userId, utente.idAmministrazione, this.Session.SessionID);

                        //Rimuovo le notifiche del vecchio utente per far si che il centro notifiche venga aggiornato correttamente
                        HttpContext.Current.Session.Remove("ListAllNotify");
                        Response.Redirect("../Index.aspx");
                    }
                    break;

                case DocsPaWR.LoginResult.USER_ALREADY_LOGGED_IN:
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "ajaxDialogModal('WarningMandateUserAlreadyLoggedIn', 'warning', '');", true);
                    break;

                case DocsPaWR.LoginResult.NO_RUOLI:
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "ajaxDialogModal('WarningMandateNoRoles', 'warning', '');", true);
                    break;

                default:
                    // Application Error
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "ajaxDialogModal('ErrorMandateGeneral', 'error', '');", true);
                    break;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ajaxDialogModal", "ajaxDialogModal('ErrorMandateNoneSelected', 'error', '');", true);
            }
        }
示例#41
0
    protected void RecordStats_Click(object sender, EventArgs e)
    {
        GridViewRow           agvrow           = GamesPlayedList.Rows[GamesPlayedList.SelectedIndex];
        int                   gameid           = int.Parse((agvrow.FindControl("GameID") as Label).Text);
        PlayerGameStat        aPlayer          = null;
        List <PlayerGameStat> hometeamlist     = new List <PlayerGameStat>();
        List <PlayerGameStat> visitingteamlist = new List <PlayerGameStat>();

        MessageUserControl.TryRun(() =>
        {
            int aNumeric = 0;
            foreach (GridViewRow arow in HomeTeamList.Rows)
            {
                aPlayer          = new PlayerGameStat();
                aPlayer.PlayerID = int.Parse((arow.FindControl("PlayerID") as Label).Text);
                if (string.IsNullOrEmpty((arow.FindControl("Goals") as TextBox).Text))
                {
                    aPlayer.Goals = 0;
                }
                else
                {
                    if (int.TryParse((arow.FindControl("Goals") as TextBox).Text, out aNumeric))
                    {
                        aPlayer.Goals = aNumeric;
                    }
                    else
                    {
                        throw new Exception("You have not entered a number for a Goal at some point.");
                    }
                }
                if (string.IsNullOrEmpty((arow.FindControl("Assists") as TextBox).Text))
                {
                    aPlayer.Assists = 0;
                }
                else
                {
                    if (int.TryParse((arow.FindControl("Assists") as TextBox).Text, out aNumeric))
                    {
                        aPlayer.Assists = aNumeric;
                    }
                    else
                    {
                        throw new Exception("You have not entered a number for an Assists at some point.");
                    }
                }
                aPlayer.Yellow   = (arow.FindControl("YellowCard") as CheckBox).Checked;
                aPlayer.Red      = (arow.FindControl("RedCard") as CheckBox).Checked;
                aPlayer.Rostered = (arow.FindControl("Rostered") as CheckBox).Checked;
                hometeamlist.Add(aPlayer);
            }

            foreach (GridViewRow arow in VisitingTeamList.Rows)
            {
                aPlayer          = new PlayerGameStat();
                aPlayer.PlayerID = int.Parse((arow.FindControl("PlayerID") as Label).Text);
                if (string.IsNullOrEmpty((arow.FindControl("Goals") as TextBox).Text))
                {
                    aPlayer.Goals = 0;
                }
                else
                {
                    if (int.TryParse((arow.FindControl("Goals") as TextBox).Text, out aNumeric))
                    {
                        aPlayer.Goals = aNumeric;
                    }
                    else
                    {
                        throw new Exception("You have not entered a number for a Goal at some point.");
                    }
                }
                if (string.IsNullOrEmpty((arow.FindControl("Assists") as TextBox).Text))
                {
                    aPlayer.Assists = 0;
                }
                else
                {
                    if (int.TryParse((arow.FindControl("Assists") as TextBox).Text, out aNumeric))
                    {
                        aPlayer.Assists = aNumeric;
                    }
                    else
                    {
                        throw new Exception("You have not entered a number for an Assists at some point.");
                    }
                }
                aPlayer.Yellow   = (arow.FindControl("YellowCard") as CheckBox).Checked;
                aPlayer.Red      = (arow.FindControl("RedCard") as CheckBox).Checked;
                aPlayer.Rostered = (arow.FindControl("Rostered") as CheckBox).Checked;
                visitingteamlist.Add(aPlayer);
            }
            PlayerStatController sysmgr = new PlayerStatController();
            sysmgr.RecordGamePlayerStats(gameid, hometeamlist, visitingteamlist);
            HomeTeamName.Text       = "";
            HomeTeamScore.Text      = "";
            VisitingTeamName.Text   = "";
            VisitingTeamScore.Text  = "";
            HomeTeamList.DataSource = null;
            HomeTeamList.DataBind();
            VisitingTeamList.DataSource = null;
            VisitingTeamList.DataBind();
            GamesPlayedList.DataBind();
        }, "Player Stat Recording", "Stats have been successfully recorded for the game");
    }
示例#42
0
        protected void grdContactDetails_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Guid        myRow_Id = Guid.Parse(e.CommandArgument.ToString());
            GridViewRow row      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         index    = row.RowIndex;

            if (e.CommandName == "Select")
            {
                // Activity_Flavour_Id = new Guid(Request.QueryString["Activity_Flavour_Id"]);
                //Activity_Id = new Guid(Request.QueryString["Activity_Id"])
                List <MDMSVC.DC_Activity_Contact> obj = new List <MDMSVC.DC_Activity_Contact>();
                obj.Add(new MDMSVC.DC_Activity_Contact
                {
                    Activity_Contact_Id = myRow_Id,
                    Activity_Flavour_Id = Activity_Flavour_Id,
                    // Activity_Id = Activity_Id,
                    Email      = grdContactDetails.Rows[index].Cells[3].Text,
                    WebSiteURL = grdContactDetails.Rows[index].Cells[2].Text,
                    Telephone  = grdContactDetails.Rows[index].Cells[0].Text,
                    Fax        = grdContactDetails.Rows[index].Cells[1].Text
                });


                if (!string.IsNullOrEmpty(grdContactDetails.Rows[index].Cells[4].Text))
                {
                    obj[0].Legacy_Product_ID = Convert.ToInt32(grdContactDetails.Rows[index].Cells[4].Text);
                }
                frmContactDetaiil.ChangeMode(FormViewMode.Edit);
                frmContactDetaiil.DataSource = obj;
                frmContactDetaiil.DataBind();

                TextBox txtTelCountryCode  = (TextBox)frmContactDetaiil.FindControl("txtTelCountryCode");
                TextBox txtTelCityCode     = (TextBox)frmContactDetaiil.FindControl("txtTelCityCode");
                TextBox txtTelLocalNUmber  = (TextBox)frmContactDetaiil.FindControl("txtTelLocalNUmber");
                TextBox txtFaxCountryCode  = (TextBox)frmContactDetaiil.FindControl("txtFaxCountryCode");
                TextBox txtFaxCityCode     = (TextBox)frmContactDetaiil.FindControl("txtFaxCityCode");
                TextBox txtFaxLocalNUmber  = (TextBox)frmContactDetaiil.FindControl("txtFaxLocalNUmber");
                TextBox txtWebsite         = (TextBox)frmContactDetaiil.FindControl("txtWebsite");
                TextBox txtEmail           = (TextBox)frmContactDetaiil.FindControl("txtEmail");
                TextBox txtLegacyProductId = (TextBox)frmContactDetaiil.FindControl("txtLegacyProductId");

                string[] brkTelephone = System.Web.HttpUtility.HtmlDecode(grdContactDetails.Rows[index].Cells[0].Text).Split('-');
                string[] brkFax       = System.Web.HttpUtility.HtmlDecode(grdContactDetails.Rows[index].Cells[1].Text).Split('-');
                if (brkTelephone.Length == 3)
                {
                    txtTelCountryCode.Text = brkTelephone[0];
                    txtTelCityCode.Text    = brkTelephone[1];
                    txtTelLocalNUmber.Text = brkTelephone[2];
                }
                else
                {
                    txtTelCountryCode.Text = "";
                    txtTelCityCode.Text    = "";
                    txtTelLocalNUmber.Text = System.Web.HttpUtility.HtmlDecode(grdContactDetails.Rows[index].Cells[0].Text);
                }
                if (brkFax.Length == 3)
                {
                    txtFaxCountryCode.Text = brkFax[0];
                    txtFaxCityCode.Text    = brkFax[1];
                    txtFaxLocalNUmber.Text = brkFax[2];
                }
                else
                {
                    txtFaxCountryCode.Text = "";
                    txtFaxCityCode.Text    = "";
                    txtFaxLocalNUmber.Text = System.Web.HttpUtility.HtmlDecode(grdContactDetails.Rows[index].Cells[1].Text);
                }
                txtWebsite.Text         = System.Web.HttpUtility.HtmlDecode(grdContactDetails.Rows[index].Cells[2].Text);
                txtEmail.Text           = System.Web.HttpUtility.HtmlDecode(grdContactDetails.Rows[index].Cells[3].Text);
                txtLegacyProductId.Text = System.Web.HttpUtility.HtmlDecode(grdContactDetails.Rows[index].Cells[4].Text);
            }

            else if (e.CommandName.ToString() == "SoftDelete")
            {
                TLGX_Consumer.MDMSVC.DC_Activity_Contact newObj = new MDMSVC.DC_Activity_Contact
                {
                    Activity_Contact_Id = myRow_Id,
                    IsActive            = false,
                    Edit_Date           = DateTime.Now,
                    Edit_User           = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.UpdateActivityContactDetails(newObj))
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsgContact, "Contact has been deleted successfully", BootstrapAlertType.Success);
                    fillcontactdetails();
                }
                ;
            }

            else if (e.CommandName.ToString() == "UnDelete")
            {
                TLGX_Consumer.MDMSVC.DC_Activity_Contact newObj = new MDMSVC.DC_Activity_Contact
                {
                    Activity_Contact_Id = myRow_Id,
                    IsActive            = true,
                    Edit_Date           = DateTime.Now,
                    Edit_User           = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.UpdateActivityContactDetails(newObj))
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsgContact, "Contact has been retrieved successfully", BootstrapAlertType.Success);
                    fillcontactdetails();
                }
                ;
            }
        }
示例#43
0
        protected void gMain_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = gMain.Rows[e.RowIndex];

            if (row != null)
            {
                string orig              = ViewState["OriginalZip"].ToString();
                string zip               = (((TextBox)row.FindControl("txtZip")).Text.Trim()).ToString();
                string countryid         = ((DropDownList)row.FindControl("ddlCountry")).SelectedValue.Trim();
                string OriginalCountryID = AppLogic.GetCountryID(ViewState["OriginalCountryID"].ToString()).ToString();

                StringBuilder sql = new StringBuilder(1024);

                //make sure no duplicates
                if (!orig.Equals(zip))
                {
                    int count = DB.GetSqlN(String.Format("SELECT count(*) AS N FROM ZipTaxRate WHERE ZipCode = {0} and CountryId = {1}", DB.SQuote(zip), CommonLogic.IIF(someCountryRequirePostalCode > 0, Convert.ToInt32(countryid), -1)));
                    if (count > 0)
                    {
                        resetError("Duplicate Zip Code exists", true);
                        return;
                    }
                }

                try
                {
                    resetError("Item updated", false);
                    gMain.EditIndex        = -1;
                    ViewState["SQLString"] = selectSQL;

                    for (int i = 0; i <= Request.Form.Count - 1; i++)
                    {
                        //TR_CLASSID_ZipCode
                        if (Request.Form.Keys[i].IndexOf("TR_") != -1)
                        {
                            String[] keys    = Request.Form.Keys[i].Split('_');
                            string   ZipCode = keys[2];
                            int      ClassID = Localization.ParseUSInt(keys[1]);
                            decimal  taxrate = Decimal.Zero;
                            if (ZipCode == orig && e.RowIndex == Convert.ToInt32(keys[3]))
                            {
                                try
                                {
                                    taxrate = Localization.ParseNativeDecimal(Request.Form[Request.Form.Keys[i]]);
                                }
                                catch { }

                                ZipTaxRate ztr3 = AppLogic.ZipTaxRatesTable[zip, ClassID, Convert.ToInt32(countryid)];
                                try
                                {
                                    if (ztr3 != null)
                                    {
                                        if (Convert.ToInt32(countryid) != Convert.ToInt32(OriginalCountryID))
                                        {
                                            resetError("Zip Code, Tax Class ID and Country ID already exists.", false);
                                        }
                                        else
                                        {
                                            ztr3.Update(taxrate, Convert.ToInt32(countryid));
                                        }
                                    }
                                    else
                                    {
                                        bool validZipFormat = true;
                                        if ((Convert.ToInt32(countryid) != Convert.ToInt32(OriginalCountryID)) || (orig != zip))
                                        {
                                            if (Convert.ToInt32(countryid) != Convert.ToInt32(OriginalCountryID))
                                            {
                                                validZipFormat = AppLogic.ValidatePostalCode(zip, Convert.ToInt32(countryid));
                                            }
                                            if (validZipFormat)
                                            {
                                                ZipTaxRates ztr2 = new ZipTaxRates();
                                                foreach (ZipTaxRate ztr in ztr2.All)
                                                {
                                                    if (ztr.ZipCode == orig && ztr.TaxClassID == ClassID && ztr.CountryID == Convert.ToInt32(OriginalCountryID))
                                                    {
                                                        ztr.Update(taxrate, zip, Convert.ToInt32(countryid), Convert.ToInt32(OriginalCountryID));
                                                        AppLogic.ZipTaxRatesTable.AddNewRate(ztr.ZipTaxID, zip, ClassID, taxrate, Convert.ToInt32(countryid));
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                resetError(AppLogic.GetCountryPostalErrorMessage(Convert.ToInt32(countryid), cust.SkinID, cust.LocaleSetting), true);
                                            }
                                        }
                                        else
                                        {
                                            AppLogic.ZipTaxRatesTable.Add(ZipCode, ClassID, taxrate, Convert.ToInt32(countryid));
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    string err = ex.Message;
                                }
                            }
                        }
                    }
                    buildGridData();
                }
                catch (Exception ex)
                {
                    throw new Exception("Couldn't update database: " + sql.ToString() + ex.ToString());
                }
            }
        }
示例#44
0
    //检索栏检索其他按钮
    //protected void BtnSearchElse_Click(object sender, EventArgs e)
    //{
    //    Grid_ProType.Columns[3].Visible = false;
    //    Grid_ProType.Columns[4].Visible = false;
    //    Grid_ProType.Columns[5].Visible = false;
    //    Grid_ProType.Columns[6].Visible = true;
    //    LblGridProType.Text = "其他产品型号表";
    //    condSearch.Text = "QT";//以此变量存储检索栏是否处于检索其他的状态
    //    if (TxtProSeries.Text != "")
    //    {
    //        PS_Name = TxtProSeries.Text;
    //    }
    //    if (TxtProType.Text != "")
    //    {
    //        PT_Name = TxtProType.Text;
    //    }
    //    BindGrid1QT(PS_Name, PT_Name);
    //    this.UpdatePanel_GridProType.Update();
    //}

    #endregion

    #region 产品型号表Grid1
    //操作Gridview的命令行
    protected void Grid_ProType_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Edt_CFCraft")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            Grid_ProType.SelectedIndex = row.RowIndex;
            GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent));
            id2 = new Guid(e.CommandArgument.ToString());
            IQCBasicDataInfo IQC = new IQCBasicDataInfo();
            IQC             = iQCBasicDataL.Search_ProType_ID(id2)[0];
            LblRZState.Text = IQC.PT_Name;
            BindGrid2(id2);
            Panel_GridCFCraft.Visible = true;
            UpdatePanel_GridCFCraft.Update();
            Panel_CFRoute.Visible = false;
            UpdatePanel_CFRoute.Update();
            condSearch4         = "";
            LblState.Text       = "认证";                           //用“认证”标识grid4处于认证工序检索,“工艺”标识处于认证工艺路线检索
            LblGongxuState.Text = "认证";                           //用“认证”标识grid4处于认证工序编辑,“工艺”标识处于认证工艺路线编辑

            ((BoundField)Grid_Craft.Columns[1]).ReadOnly = false; //注意类型转换,你所操作的列的类型是BoundField

            ((BoundField)Grid_Craft.Columns[2]).ReadOnly = true;

            id4 = id2;
            IQCBasicDataInfo IQC1 = new IQCBasicDataInfo();
            IQC1            = iQCBasicDataL.Search_ProType_ID(id2)[0];
            LblSCState.Text = IQC1.PT_Name;
            BindGrid4(id4);
            UpdatePanel_SearchCraft.Update();
        }
        if (e.CommandName == "Edt_CFRoute")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            Grid_ProType.SelectedIndex = row.RowIndex;
            GridViewRow gvr = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent));
            id3 = new Guid(e.CommandArgument.ToString());
            IQCBasicDataInfo IQC = new IQCBasicDataInfo();
            IQC             = iQCBasicDataL.Search_ProType_ID(id3)[0];
            LblRTState.Text = IQC.PT_Name;
            BindGrid3(id3);
            Panel_CFRoute.Visible = true;
            UpdatePanel_CFRoute.Update();
            Panel_GridCFCraft.Visible = false;
            UpdatePanel_GridCFCraft.Update();
            condSearch4         = "";
            LblState.Text       = "工艺";                          //用“认证”标识grid4处于认证工序检索,“工艺”标识处于认证工艺路线检索
            LblGongxuState.Text = "工艺";                          //用“认证”标识grid4处于认证工序编辑,“工艺”标识处于认证工艺路线编辑
            ((BoundField)Grid_Craft.Columns[1]).ReadOnly = true; //注意类型转换,你所操作的列的类型是BoundField

            ((BoundField)Grid_Craft.Columns[2]).ReadOnly = false;

            id4 = id3;
            IQCBasicDataInfo IQC1 = new IQCBasicDataInfo();
            IQC1            = iQCBasicDataL.Search_ProType_ID(id3)[0];
            LblSCState.Text = IQC1.PT_Name;
            BindGrid4(id4);
            UpdatePanel_SearchCraft.Update();
        }
        if (e.CommandName == "Delete_ProType")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            Grid_ProType.SelectedIndex = row.RowIndex;
            Guid guid = new Guid(e.CommandArgument.ToString());
            try
            {
                iQCBasicDataL.Delete_ProType_RZ(guid);
            }
            catch (Exception exc)
            {
                ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('删除失败!" + exc + "')", true);
            }
            ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('删除成功!')", true);
            BindGrid1RZ(PS_Name, PT_Name);
            UpdatePanel_GridProType.Update();
        }
        if (e.CommandName == "Chs_ProType")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            Grid_ProType.SelectedIndex = row.RowIndex;
            Guid guid = new Guid(e.CommandArgument.ToString());
            try
            {
                iQCBasicDataL.Insert_ProType_RZ(guid);
            }
            catch (Exception exc)
            {
                ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('新增失败!" + exc + "')", true);
            }
            ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "alert", "alert('新增成功!')", true);
            BindGrid1QT(PS_Name, PT_Name);
            UpdatePanel_GridProType.Update();
        }
    }
示例#45
0
 void helper_GroupSummary(string groupName, object[] values, GridViewRow row)
 {
     row.Cells[0].Text = values[0].ToString();
 }
 //Para chequear una fila
 protected void chkDelete_CheckedChanged(object sender, EventArgs e)
 {
     CheckBox    chkStatus = (CheckBox)sender;
     GridViewRow row       = (GridViewRow)chkStatus.NamingContainer;
 }
示例#47
0
        protected void GridView1_OnRowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "detalles")
            {
                LinkButton  btnDetalles = (LinkButton)e.CommandSource;
                GridViewRow gvrow       = (GridViewRow)btnDetalles.NamingContainer;

                int idProveedor = Convert.ToInt32(GridView1.DataKeys[gvrow.RowIndex]?.Value);

                using (var sqlConnection = new SqlConnection(cadenaConexion))
                {
                    SqlCommand     sqlCommand     = new SqlCommand("SeleccionarProveedorById", sqlConnection);
                    SqlDataAdapter SqlDataAdapter = new SqlDataAdapter(sqlCommand);
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlCommand.Parameters.AddWithValue("@idProveedor", idProveedor);
                    DataTable dataTable = new DataTable();
                    SqlDataAdapter.Fill(dataTable);

                    lblIdProveedor.Text              = dataTable.Rows[0][0].ToString();
                    lblPrimerNombreProveedor.Text    = dataTable.Rows[0][1].ToString();
                    lblSegundoNombreProveedor.Text   = dataTable.Rows[0][2].ToString();
                    lblPrimerApellidoProveedor.Text  = dataTable.Rows[0][3].ToString();
                    lblSegundoApellidoProveedor.Text = dataTable.Rows[0][4].ToString();
                    lblTelefonoProveedor.Text        = dataTable.Rows[0][5].ToString();
                    lblEmpresaProveedor.Text         = dataTable.Rows[0][6].ToString();
                }
                ModalDetalles(true);
            }
            else if (e.CommandName == "editar")
            {
                LinkButton  btnEditar = (LinkButton)e.CommandSource;
                GridViewRow gvrow     = (GridViewRow)btnEditar.NamingContainer;

                int idProveedor = Convert.ToInt32(GridView1.DataKeys[gvrow.RowIndex]?.Value);

                using (var sqlConnection = new SqlConnection(cadenaConexion))
                {
                    SqlCommand     sqlCommand     = new SqlCommand("SeleccionarProveedorById", sqlConnection);
                    SqlDataAdapter SqlDataAdapter = new SqlDataAdapter(sqlCommand);
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlCommand.Parameters.AddWithValue("@idProveedor", idProveedor);
                    DataTable dataTable = new DataTable();
                    SqlDataAdapter.Fill(dataTable);

                    inpIdProveedor_e.Value              = dataTable.Rows[0][0].ToString();
                    inpPrimerNombreProveedor_e.Value    = dataTable.Rows[0][1].ToString();
                    inpSegundoNombreProveedor_e.Value   = dataTable.Rows[0][2].ToString();
                    inpPrimerApellidoProveedor_e.Value  = dataTable.Rows[0][3].ToString();
                    inpSegundoApellidoProveedor_e.Value = dataTable.Rows[0][4].ToString();
                    inpTelefonoProveedor_e.Value        = dataTable.Rows[0][5].ToString();
                    inpEmpresaProveedor_e.Value         = dataTable.Rows[0][6].ToString();
                }
                ModalEditar(true);
            }
            else if (e.CommandName == "eliminar")
            {
                LinkButton  btnEliminar = (LinkButton)e.CommandSource;
                GridViewRow gvrow       = (GridViewRow)btnEliminar.NamingContainer;

                int idProveedor = Convert.ToInt32(GridView1.DataKeys[gvrow.RowIndex]?.Value);
                lblIdProveedorEliminar.Text = HttpUtility.HtmlDecode(gvrow.Cells[0].Text);
                ModalEliminar(true);
            }
        }
示例#48
0
    /// <summary>
    /// End GridView Space Info Funcations
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>



    /////star of Stroage lots Info Grids Funcations////////////////


    protected void gvLot_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "AddMore")
        {
            LinkButton lnkbtnAddMoreSetting = gvLot.FooterRow.FindControl("lnkbtnAddMore") as LinkButton;
            LinkButton lnkbtnAddSetting     = gvLot.FooterRow.FindControl("lnkbtnAddSetting") as LinkButton;
            LinkButton lnkbtnCancelSetting  = gvLot.FooterRow.FindControl("lnkbtnCancelSetting") as LinkButton;


            lnkbtnAddSetting.Visible     = true;
            lnkbtnAddMoreSetting.Visible = false;
            lnkbtnCancelSetting.Visible  = true;

            TextBox txtLotFooter = gvLot.FooterRow.FindControl("txtLotfooter") as TextBox;
            //TextBox txtSpace = gvSetting.FooterRow.FindControl("txtSpaces") as TextBox;
            txtLotFooter.Visible = true;
        }

        if (e.CommandName == "AddLotSpace")
        {
            lblErrorLane.Text  = String.Empty;
            lblErrorLot.Text   = String.Empty;
            lblErrorSpace.Text = String.Empty;


            pnlLot.Visible   = false;
            pnlSpace.Visible = true;
            hidLotId.Value   = Convert.ToString(e.CommandArgument);

            GridViewRow gvr      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         RemoveAt = gvr.RowIndex;
            Label       lbl      = (Label)gvLot.Rows[RemoveAt].FindControl("lbllotnumber");
            lblLotNumberSpace.Text   = lbl.Text;
            lblFacilityForSpace.Text = lblfacilityname.Text;
            LoadRows(1);
        }


        if (e.CommandName == "Insert")
        {
            try
            {
                TextBox txtParkingLot = (TextBox)((GridView)sender).FooterRow.FindControl("txtLotfooter");

                int  id  = 0;
                Lots lot = new Lots();
                lot.LotNumber      = txtParkingLot.Text.Trim(); //Guid.NewGuid().ToString().Substring(0, 6);
                lot.Quantity       = 0;
                lot.OrganizationId = UserOrganizationId;        // Convert.ToInt32(ddlStakeholder.SelectedValue);
                lot.DateCreated    = DateTime.Now;
                lot.IsActive       = true;
                lot.SpaceId        = 0;
                lot.UserID         = LoginMemberId;          // currentUserInfo.UserId;
                lot.RoleID         = UserOrganizationRoleId; // currentUserInfo.RoleId;
                lot.IsCompleted    = true;


                BarCode br = new BarCode();
                br.DateCreated    = DateTime.Now.ToString();
                br.OrganizationID = UserOrganizationId;
                br.BarCodeNumber  = GenerateLotSerialNumber();
                Guid   g   = Guid.NewGuid();
                string str = g.ToString().Replace("-", "");
                if (br.GenerateLotBarCodeImage(str))
                {
                    hdnLotBarCodeImageFileName.Value = str + ".gif";
                    //imgLotBarcode.ImageUrl = String.Format("/images/temp/{0}.Gif", str);
                    //imgLotBarcode.Visible = true;
                }
                if (System.IO.File.Exists(Server.MapPath(String.Format("/images/temp/{0}", hdnLotBarCodeImageFileName.Value))))
                {
                    br.Image = System.IO.File.ReadAllBytes(Server.MapPath(String.Format("/images/temp/{0}", hdnLotBarCodeImageFileName.Value)));
                }
                lot.BarCodeId = BarCode.Insert(br);

                lot.SubLot    = false;
                lot.Permanent = true;
                string serialNumber = Lots.insertLot(lot, out id, str);
                hidLotId.Value = id.ToString();
                //lbkSaveLot.Visible = false;
                dvLotRecord.Visible = true;
                LoadLots(1);
                //dvSpaceRecord.Visible = true;
            }
            catch (Exception ex)
            {
                new SqlLog().InsertSqlLog(0, "addInventory.lnkLotSave_Click", ex);
            }
        }

        else if (e.CommandName == "Edit")
        {
            hidLotId.Value   = Convert.ToString(e.CommandArgument);
            lblErrorLot.Text = string.Empty;
        }

        else if (e.CommandName == "Delete")
        {
            int lotId = Convert.ToInt32(e.CommandArgument);
            if (!lothaveTire(lotId))
            {
                Lots.deleteLot(lotId);
                lblErrorLot.Text = string.Empty;
                LoadLots(1);
                lblErrorLane.Text  = string.Empty;
                lblErrorLot.Text   = string.Empty;
                lblErrorSpace.Text = string.Empty;
            }
        }
        else if (e.CommandName == "RowInfoPopUp")
        {
            LotRowControl.Visible = true;

            lblErrorLot.Text = String.Empty;
            //lblErrorSpace.Text = String.Empty;

            dvpopupfacilityinfo.Visible = true;
            //pnlLot.Visible = false;


            hidLotId.Value = Convert.ToString(e.CommandArgument);
            Lots objLots = new Lots(Conversion.ParseInt(hidLotId.Value));

            GridViewRow gvr      = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         RemoveAt = gvr.RowIndex;
            HiddenField lbl      = (HiddenField)gvLot.Rows[RemoveAt].FindControl("hdGVLotNumber");
            hdnlotname.Value = lbl.Value;
            LotRowControl.loadFacilityandLotName(objLots.FacilityName, lbl.Value, hndfacilityId.Value);
            LotRowControl.loadLotRows(Convert.ToInt32(e.CommandArgument));
        }

        else if (e.CommandName == "Cancel")
        {
            gvLot.EditIndex = -1;
            LoadLots(1);
        }
    }
示例#49
0
 /// <summary>
 /// Gets the value that should be exported to Excel
 /// </summary>
 /// <param name="row">The row.</param>
 /// <returns></returns>
 public override object GetExportValue(GridViewRow row)
 {
     return(base.GetExportValue(row) ?? string.Empty);
 }
示例#50
0
    //private void AddControl(string letter, string fullName, IList<ManagementIndicatorsDetail> details, int tblNum)
    //{
    //    Table tbl = new Table();
    //    tbl.Attributes.Add("width", "100%");
    //    tbl.BorderWidth = 0;
    //    tbl.CellSpacing = 1;
    //    tbl.CellPadding = 0;
    //    tbl.ID = "TBL" + tblNum;
    //    //Build(details, tbl, fullName, letter);
    //    this.Controls.Add(tbl);

    //    details.Clear();
    //    tbl.Dispose();
    //}


    void helper_GroupEnd(string groupName, object[] values, GridViewRow row)
    {
        row.Cells[0].Text = "bfgdfggdfgdfgfdgd";//values[0].ToString();
    }
示例#51
0
    protected void lnk_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton btn = (ImageButton)sender;
        GridViewRow gvr = btn.NamingContainer as GridViewRow;
        string      ID  = gvDTCLogicBuild.DataKeys[gvr.RowIndex].Values["dtc_LOGIC_BUILD_PK"].ToString();

        hfvMgrID.Value = ID;
        hfvMode.Value  = "Edit";
        using (miniSmartDataContext db = new miniSmartDataContext())
        {
            var qry = from b in db.tab_CA_EMS_DTC_LOGIC_BUILDs
                      where b.dtc_LOGIC_BUILD_PK == Convert.ToInt32(ID)
                      select new { b.dtc_DTC_CODE_A, b.dtc_DTC_LOGIC_A, b.dtc_DTC_CODE_B, b.dtc_DTC_LOGIC_B, b.dtc_DTC_CODE_C, b.dtc_DTC_LOGIC_C, b.dtc_DTC_CODE_D, b.dtc_DTC_LOGIC_D, b.dtc_LOGIC_CONCLUSION, b.dtc_LOGIC_OPERATION, b.dtc_LOGIC_SMILEY, b.dtc_DTC_CODE_A_INVERT, b.dtc_DTC_CODE_B_INVERT, b.dtc_DTC_CODE_C_INVERT, b.dtc_DTC_CODE_D_INVERT };

            if (qry.Count() > 0)
            {
                foreach (var c in qry)
                {
                    ddlDTCA.SelectedValue = Convert.ToString(c.dtc_DTC_CODE_A + "_" + c.dtc_DTC_LOGIC_A);
                    ddlDTCA_SelectedIndexChanged(null, null);
                    if (c.dtc_DTC_CODE_B != null)
                    {
                        ddlDTCB.SelectedValue = Convert.ToString(c.dtc_DTC_CODE_B + "_" + c.dtc_DTC_LOGIC_B);
                    }
                    else
                    {
                        ddlDTCB.SelectedIndex = 0;
                    }
                    ddlDTCB_SelectedIndexChanged(null, null);

                    if (c.dtc_DTC_CODE_C != null)
                    {
                        ddlDTCC.SelectedValue = Convert.ToString(c.dtc_DTC_CODE_C + "_" + c.dtc_DTC_LOGIC_C);
                    }
                    else
                    {
                        ddlDTCC.SelectedIndex = 0;
                    }
                    ddlDTCC_SelectedIndexChanged(null, null);

                    if (c.dtc_DTC_CODE_D != null)
                    {
                        ddlDTCD.SelectedValue = Convert.ToString(c.dtc_DTC_CODE_D + "_" + c.dtc_DTC_LOGIC_D);
                    }
                    else
                    {
                        ddlDTCD.SelectedIndex = 0;
                    }

                    if (c.dtc_DTC_CODE_A_INVERT != null)
                    {
                        DTCANotGate.Checked = Convert.ToBoolean(c.dtc_DTC_CODE_A_INVERT);
                    }
                    if (c.dtc_DTC_CODE_B_INVERT != null)
                    {
                        DTCBNotGate.Checked = Convert.ToBoolean(c.dtc_DTC_CODE_B_INVERT);
                    }
                    if (c.dtc_DTC_CODE_C_INVERT != null)
                    {
                        DTCCNotGate.Checked = Convert.ToBoolean(c.dtc_DTC_CODE_C_INVERT);
                    }
                    if (c.dtc_DTC_CODE_D_INVERT != null)
                    {
                        DTCDNotGate.Checked = Convert.ToBoolean(c.dtc_DTC_CODE_D_INVERT);
                    }

                    ddlOperation.SelectedValue = Convert.ToString(c.dtc_LOGIC_OPERATION);
                    txtConclusion.Text         = Convert.ToString(c.dtc_LOGIC_CONCLUSION);

                    rbtSmiley.SelectedValue = Convert.ToString(c.dtc_LOGIC_SMILEY);
                }
            }
        }
        btnSave.InnerText = "Update";
        ScriptManager.RegisterStartupScript(this, this.GetType(), "LaunchServerSide", "$(function() { showEditModal(); });", true);
    }
        protected void gvPosts_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            diverror.InnerHtml = "";

            if (e.CommandName == "Edit")
            {
                // Retrieve the row index stored in the
                // CommandArgument property.
                int index = Convert.ToInt32(e.CommandArgument);

                // Retrieve the row that contains the button
                // from the Rows collection.
                GridViewRow row = gvPosts.Rows[index];
                Session.Add("ProjectIDForEdit", row.Cells[0].Text);

                Response.Redirect("/Admin/EditProject");//edit
            }
            if (e.CommandName == "Show")
            {
                // Retrieve the row index stored in the
                // CommandArgument property.
                int index = Convert.ToInt32(e.CommandArgument);

                // Retrieve the row that contains the button
                // from the Rows collection.
                GridViewRow row = gvPosts.Rows[index];

                string id = row.Cells[0].Text;

                Response.Redirect("/Projects/" + id + "/" + row.Cells[1].Text.Replace(' ', '-'));//show
            }
            if (e.CommandName == "Delet")
            {
                // Retrieve the row index stored in the
                // CommandArgument property.
                int index = Convert.ToInt32(e.CommandArgument);

                // Retrieve the row that contains the button
                // from the Rows collection.
                GridViewRow          row      = gvPosts.Rows[index];
                int                  id       = row.Cells[0].Text.ToInt();
                ProjectsRepository   repart   = new ProjectsRepository();
                ProjectConRepository repgpCon = new ProjectConRepository();
                string               img      = "";
                string               fimg     = "";

                Project pr = repart.FindeProjectByID(id);
                if (pr != null)
                {
                    img  = pr.Image;
                    fimg = pr.ImgFisrtPage;
                }
                if (repgpCon.DeletProjectConnections(id) && repart.DeletProjectByID(id))
                {
                    subgroup();
                    FileInfo fi = new FileInfo(Server.MapPath(@"~\img\") + img.Substring(5));
                    fi.Delete();
                    FileInfo fil = new FileInfo(Server.MapPath(@"~\img\") + fimg.Substring(5));
                    fil.Delete();
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('حذف با موفقیت انجام شد ');", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('حذف با خطا مواجه شد ، بعدا سعی کنید یا با پشتیبانی تماس بگیرید!');", true);
                }
            }
        }
示例#53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MergePersonFieldRowEventArgs"/> class.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <param name="mergePersonField">The merge person field.</param>
 public MergePersonFieldRowEventArgs(GridViewRow row, MergePersonField mergePersonField) : base(row)
 {
     MergePersonField = mergePersonField;
 }
        protected void btn_confirm_Click(object sender, EventArgs e)
        {
            btn_confirm.Enabled = false;
            string[] Arry;
            Arry = Request.QueryString["ptcode_rcode"].Split(',');
            string        orderno     = "";
            string        sqltext     = "";
            List <string> sqltextlist = new List <string>();
            int           temp        = checkednum();

            if (temp == 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择要用来追加的订单!');", true);
                return;
            }
            else if (temp == 2)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('只能选择其中一个用来追加的订单!');", true);
                return;
            }
            else if (temp == 1)
            {
                for (int i = 0; i < GridView1.Rows.Count; i++)
                {
                    GridViewRow gr  = GridView1.Rows[i];
                    CheckBox    ckb = (CheckBox)gr.FindControl("CheckBox1");
                    if (ckb.Checked)
                    {
                        orderno = gr.Cells[2].Text;
                        break;
                    }
                }


                string    sql     = "select TA_ZDTIME from TBMP_ACCOUNTS where TA_DOCNUM='" + orderno + "'";
                DataTable dt0     = DBCallCommon.GetDTUsingSqlText(sql);
                string    zdtime  = dt0.Rows[0]["TA_ZDTIME"].ToString().Trim();
                string    zddate  = zdtime.Substring(0, 7).ToString();
                string    sqlwxhs = "select * from TBFM_WXHS where WXHS_STATE='1' and WXHS_YEAR+'-'+WXHS_MONTH like '" + zddate + "%'";
                DataTable dtwxhs  = DBCallCommon.GetDTUsingSqlText(sqlwxhs);
                if (dtwxhs.Rows.Count > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('该结算单已核算,不能再追加!');", true);
                    return;
                }

                else
                {
                    if (orderno != "")
                    {
                        //sqltext = "INSERT INTO TBMP_ACCOUNTS (TA_DOCNUM, TA_ORDERNUM, TA_PTC, TA_ZDR,TA_ZDTIME,TA_NUM,TA_MONEY,TA_WGHT) select '" + orderno + "',TO_DOCNUM, TO_PTC,'" + Session["UserID"].ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "',PIC_ZXNUM,CAST(PIC_PRICE * PIC_ZXNUM AS decimal(18 , 4)),CAST(TO_UWGHT * PIC_ZXNUM AS decimal(18 , 4)) from VIEW_TBMP_Order  WHERE TO_ID in(";
                        sqltext = "INSERT INTO TBMP_ACCOUNTS (TA_DOCNUM, TA_ORDERNUM, TA_PTC, TA_ZDR,TA_ZDTIME,TA_NUM,TA_MONEY,TA_WGHT) select '" + orderno + "',TO_DOCNUM, TO_PTC,'" + Session["UserID"].ToString() + "','" + zdtime + "',PIC_ZXNUM,CAST(PIC_PRICE * PIC_ZXNUM AS decimal(18 , 4)),CAST(TO_UWGHT * PIC_ZXNUM AS decimal(18 , 4)) from VIEW_TBMP_Order  WHERE TO_ID in(";
                        for (int i = 0; i < Arry.Length - 2; i++)
                        {
                            sqltext += "'" + Arry[i].ToString() + "',";
                        }
                        sqltext += "'" + Arry[Arry.Length - 2].ToString() + "')";
                        sqltextlist.Add(sqltext);

                        //sqltext = "update TBMP_ACCOUNTS set TA_ZDTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where TA_DOCNUM='" + orderno + "'";
                        //sqltextlist.Add(sqltext);

                        sqltext = "update TBMP_Order set TO_STATE='1' where TO_ID in (";//生成订单
                        for (int i = 0; i < Arry.Length - 2; i++)
                        {
                            sqltext += "'" + Arry[i].ToString() + "',";
                        }
                        sqltext += "'" + Arry[Arry.Length - 2].ToString() + "')";
                        sqltextlist.Add(sqltext);
                        DBCallCommon.ExecuteTrans(sqltextlist);
                    }

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('追加订单成功!');window.opener.location.replace('PM_Xie_IntoAccounts.aspx?orderno=" + orderno + "');self.close()", true);
                    // Response.Redirect("TBPM_IntoOrder.aspx?orderno=" + orderno + "");
                }
            }
        }
    protected void bindbound(object sender, EventArgs e)
    {
        try
        {
            for (int i = GridView4.Rows.Count - 1; i > 0; i--)
            {
                GridViewRow row         = GridView4.Rows[i];
                GridViewRow previousRow = GridView4.Rows[i - 1];

                Label lnlname  = (Label)row.FindControl("gv4sno");
                Label lnlname1 = (Label)previousRow.FindControl("gv4sno");
                if (lnlname.Text == lnlname1.Text)
                {
                    if (previousRow.Cells[0].RowSpan == 0)
                    {
                        if (row.Cells[0].RowSpan == 0)
                        {
                            previousRow.Cells[0].RowSpan += 2;
                        }
                        else
                        {
                            previousRow.Cells[0].RowSpan = row.Cells[0].RowSpan + 1;
                        }
                        row.Cells[0].Visible = false;
                    }
                }

                lnlname  = (Label)row.FindControl("gv4dt");
                lnlname1 = (Label)previousRow.FindControl("gv4dt");

                if (lnlname.Text == lnlname1.Text)
                {
                    if (previousRow.Cells[1].RowSpan == 0)
                    {
                        if (row.Cells[1].RowSpan == 0)
                        {
                            previousRow.Cells[1].RowSpan += 2;
                        }
                        else
                        {
                            previousRow.Cells[1].RowSpan = row.Cells[1].RowSpan + 1;
                        }
                        row.Cells[1].Visible = false;
                    }
                }


                Label lnlname2  = (Label)row.FindControl("gv4dt");
                Label lnlname12 = (Label)previousRow.FindControl("gv4dt");

                lnlname  = (Label)row.FindControl("gv4count");
                lnlname1 = (Label)previousRow.FindControl("gv4count");

                if (lnlname.Text == lnlname1.Text && lnlname2.Text == lnlname12.Text)
                {
                    if (previousRow.Cells[3].RowSpan == 0)
                    {
                        if (row.Cells[3].RowSpan == 0)
                        {
                            previousRow.Cells[3].RowSpan += 2;
                        }
                        else
                        {
                            previousRow.Cells[3].RowSpan = row.Cells[3].RowSpan + 1;
                        }
                        row.Cells[3].Visible = false;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            lblerr.Text    = ex.ToString();
            lblerr.Visible = true;
        }
    }
 private void SaveDetail(GridViewRow row)
 {
 }
示例#57
0
    protected void btnHds_Click(object sender, EventArgs e)
    {
        Utility     utility = new Utility();
        GridViewRow row     = (GridViewRow)(sender as Control).Parent.Parent;
        Image       image   = new Image();

        image.ID = image.GetImageID(row.Cells[4].Text);
        image.Read(image);

        GridView gvHDs = (GridView)row.FindControl("gvHDs");
        List <HD_Physical_Specs> specslist = new List <HD_Physical_Specs>();
        Image_Physical_Specs     ips       = new Image_Physical_Specs();

        try
        {
            ips = JsonConvert.DeserializeObject <Image_Physical_Specs>(image.ClientSize);
        }
        catch
        { return; }
        if (ips == null)
        {
            return;
        }
        foreach (var hd in ips.hd)
        {
            specslist.Add(hd);
        }


        LinkButton btn = (LinkButton)row.FindControl("btnHDs");

        if (gvHDs.Visible == false)
        {
            var td = row.FindControl("tdHds");
            td.Visible    = true;
            gvHDs.Visible = true;

            gvHDs.DataSource = specslist;
            gvHDs.DataBind();
            btn.Text = "-";
        }
        else
        {
            var td = row.FindControl("tdHds");
            td.Visible    = false;
            gvHDs.Visible = false;

            btn.Text = "+";
        }

        foreach (GridViewRow hdrow in gvHDs.Rows)
        {
            string imagePath = null;

            try
            {
                Label lbl = hdrow.FindControl("lblHDSize") as Label;
                try
                {
                    if (hdrow.RowIndex.ToString() == "0")
                    {
                        imagePath = utility.GetSettings("Image Store Path") + row.Cells[4].Text;
                    }
                    else
                    {
                        string selectedHD = (hdrow.RowIndex + 1).ToString();
                        imagePath = utility.GetSettings("Image Store Path") + row.Cells[4].Text + Path.DirectorySeparatorChar + "hd" + selectedHD;
                    }
                }
                catch
                {
                    return;
                }


                float size = GetDirectorySize(new DirectoryInfo(imagePath)) / 1024f / 1024f / 1024f;
                if (size == 0.0f)
                {
                    lbl.Text = "N/A";
                }
                else
                {
                    lbl.Text = size.ToString("#.##") + " GB";
                    if (lbl.Text == " GB")
                    {
                        lbl.Text = "< .01 GB";
                    }
                }
            }
            catch
            {
                Label lbl = hdrow.FindControl("lblHDSize") as Label;
                lbl.Text        = "N/A";
                Utility.Message = "";
            }

            try
            {
                Label lblClient = hdrow.FindControl("lblHDSizeClient") as Label;


                float fltClientSize = image.CalculateMinSizeHD(image.Name, hdrow.RowIndex, "1") / 1024f / 1024f / 1024f;

                if (fltClientSize == 0.0f)
                {
                    lblClient.Text = "N/A";
                }
                else
                {
                    lblClient.Text = fltClientSize.ToString("#.##") + " GB";
                    if (lblClient.Text == " GB")
                    {
                        lblClient.Text = "< .01 GB";
                    }
                }
            }
            catch (Exception)
            {
                Label lblClient = hdrow.FindControl("lblHDSizeClient") as Label;
                lblClient.Text  = "N/A";
                Utility.Message = "";
            }
        }
    }
示例#58
0
        protected void GVDetalleFenologiaArroz_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                GridView    HeaderGrid    = (GridView)sender;
                GridViewRow HeaderGridRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);

                TableCell HeaderCell = new TableCell();

                HeaderCell.Text       = "";
                HeaderCell.ColumnSpan = 6;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Fecha y avance de siembra</div>";
                HeaderCell.ColumnSpan = 3;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Germinación emergencia</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Plántula</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Macollamiento</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Panicula</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Floración</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Grano Lechoso</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Maduración</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Cosecha y acopio</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "<div style='text-align: center'>Fecha cosecha</div>";
                HeaderCell.ColumnSpan = 2;
                HeaderGridRow.Cells.Add(HeaderCell);

                HeaderCell            = new TableCell();
                HeaderCell.Text       = "";
                HeaderCell.ColumnSpan = 1;
                HeaderGridRow.Cells.Add(HeaderCell);
                GVDetalleFenologiaArroz.Controls[0].Controls.AddAt(0, HeaderGridRow);
            }
        }
        private void ExportToExcel(string nameReport, List <InformeProduccionM> lista, string Area, string Maquina, string fInicio)
        {
            HttpResponse   response     = Response;
            StringWriter   sw           = new StringWriter();
            HtmlTextWriter htw          = new HtmlTextWriter(sw);
            Page           pageToRender = new Page();
            HtmlForm       form         = new HtmlForm();
            Label          la           = new Label();

            string Titulo = "<div align='center'>Informe SobreImpresión<br/>";

            if (Area != "")
            {
                Titulo += "Area : " + Area;
            }
            if (Maquina != "")
            {
                Titulo += " Maquina : " + Maquina;
            }
            if (fInicio != "")
            {
                Titulo += " Fecha : " + fInicio;
            }
            la.Text = Titulo + "</div><br />";

            form.Controls.Add(la);

            #region ConversionListaGrilla
            int contado = 0;
            int TotalRotCantPlan = 0; int TotalRotCantPlanSobre = 0; int TotalRotCantProdSobre = 0; int TotalRotCantDifSobre = 0; double RotPorceCantDifSobre = 0; int TotalRotCantPlanBajo = 0; int TotalRotCantProdBajo = 0; int TotalRotCantDifBajo = 0; double RotPorceCantDifBajo = 0;
            int TotalPlaCantPlan = 0; int TotalPlaCantPlanSobre = 0; int TotalPlaCantProdSobre = 0; int TotalPlaCantDifSobre = 0; double PlaPorceCantDifSobre = 0; int TotalPlaCantPlanBajo = 0; int TotalPlaCantProdBajo = 0; int TotalPlaCantDifbajo = 0; double PlaPorceCantDifBajo = 0;
            foreach (string maquinasProd in lista.Select(o => o.Maquina).Distinct())
            {
                GridView gv = new GridView();
                gv.DataSource = lista.Where(o => o.Maquina == maquinasProd);
                gv.DataBind();
                gv.HeaderStyle.BackColor = System.Drawing.Color.Blue;
                gv.HeaderStyle.ForeColor = System.Drawing.Color.White;

                gv.HeaderRow.Cells[0].Text = "Maquina";
                gv.HeaderRow.Cells[1].Text = "OT";
                gv.HeaderRow.Cells[2].Text = "NombreOT";
                gv.HeaderRow.Cells[3].Text = "Pliego";
                gv.HeaderRow.Cells[4].Text = "Cant. Planificado";
                gv.HeaderRow.Cells[5].Text = "Cant. Producida";
                gv.HeaderRow.Cells[6].Text = "Dif.";
                gv.HeaderRow.Cells[7].Text = "% ";
                if (Session["Usuario"].ToString().Trim() == "apaillaqueo" || Session["Usuario"].ToString().Trim() == "mandrade")
                {
                    gv.HeaderRow.Cells[8].Visible  = false;
                    gv.HeaderRow.Cells[10].Visible = false;
                }
                else
                {
                    gv.HeaderRow.Cells[8].Text  = "Control Wip";
                    gv.HeaderRow.Cells[10].Text = "Operador";
                }
                //gv.HeaderRow.Cells[8].Text = "Control Wip";
                gv.HeaderRow.Cells[9].Text    = "Papeles";
                gv.HeaderRow.Cells[9].Visible = false;
                //gv.HeaderRow.Cells[10].Text = "Operador";
                gv.HeaderRow.Cells[11].Visible = false;
                gv.HeaderRow.Cells[12].Visible = false;
                gv.HeaderRow.Cells[13].Visible = false;
                gv.HeaderRow.Cells[14].Visible = false;
                gv.HeaderRow.Cells[15].Visible = false;
                gv.HeaderRow.Cells[16].Visible = false;
                gv.HeaderRow.Cells[17].Visible = false;
                gv.HeaderRow.Cells[18].Visible = false;
                gv.HeaderRow.Cells[19].Visible = false;
                gv.HeaderRow.Cells[20].Visible = false;
                int CantPlanSobre    = 0;
                int CantProdSobre    = 0;
                int CantPlanBajo     = 0;
                int CantProdBajo     = 0;
                int TotalPlanificado = 0;

                for (int contador = 0; contador < gv.Rows.Count; contador++)
                {
                    GridViewRow row = gv.Rows[contador];
                    if (Session["Usuario"].ToString().Trim() == "apaillaqueo" || Session["Usuario"].ToString().Trim() == "mandrade")
                    {
                        row.Cells[8].Visible  = false;
                        row.Cells[10].Visible = false;
                    }
                    else
                    {
                        row.Cells[8].Text  = row.Cells[11].Text;
                        row.Cells[10].Text = row.Cells[9].Text;
                    }
                    //row.Cells[8].Text = row.Cells[11].Text;
                    //row.Cells[10].Text = row.Cells[9].Text;
                    row.Cells[9].Visible = false;
                    row.Cells[9].Text    = row.Cells[18].Text;
                    string Maquinagv = row.Cells[7].Text;
                    row.Cells[7].Text     = row.Cells[4].Text + "%";
                    row.Cells[6].Text     = row.Cells[17].Text;
                    row.Cells[5].Text     = row.Cells[13].Text;
                    row.Cells[4].Text     = row.Cells[3].Text;
                    row.Cells[3].Text     = row.Cells[2].Text;
                    row.Cells[2].Text     = row.Cells[1].Text;
                    row.Cells[1].Text     = row.Cells[0].Text;
                    row.Cells[0].Text     = Maquinagv;
                    row.Cells[11].Visible = false;
                    row.Cells[12].Visible = false;
                    row.Cells[13].Visible = false;
                    row.Cells[14].Visible = false;
                    row.Cells[15].Visible = false;
                    row.Cells[16].Visible = false;
                    row.Cells[17].Visible = false;
                    row.Cells[18].Visible = false;
                    row.Cells[19].Visible = false;
                    row.Cells[20].Visible = false;
                    TotalPlanificado     += Convert.ToInt32(row.Cells[4].Text);
                    if (Convert.ToInt32(row.Cells[5].Text) >= Convert.ToInt32(row.Cells[4].Text))
                    {
                        CantPlanSobre += Convert.ToInt32(row.Cells[4].Text);
                        CantProdSobre += Convert.ToInt32(row.Cells[5].Text);
                        if (row.Cells[20].Text == "Rotativas")
                        {
                            TotalRotCantPlan      += Convert.ToInt32(row.Cells[4].Text);
                            TotalRotCantPlanSobre += Convert.ToInt32(row.Cells[4].Text);
                            TotalRotCantProdSobre += Convert.ToInt32(row.Cells[5].Text);
                        }
                        else
                        {
                            TotalPlaCantPlan      += Convert.ToInt32(row.Cells[4].Text);
                            TotalPlaCantPlanSobre += Convert.ToInt32(row.Cells[4].Text);
                            TotalPlaCantProdSobre += Convert.ToInt32(row.Cells[5].Text);
                        }
                    }
                    else
                    {
                        if (row.Cells[20].Text == "Rotativas")
                        {
                            TotalRotCantPlan     += Convert.ToInt32(row.Cells[4].Text);
                            CantPlanBajo         += Convert.ToInt32(row.Cells[4].Text);
                            TotalRotCantPlanBajo += Convert.ToInt32(row.Cells[4].Text);
                            CantProdBajo         += Convert.ToInt32(row.Cells[5].Text);
                            TotalRotCantProdBajo += Convert.ToInt32(row.Cells[5].Text);
                        }
                        else
                        {
                            TotalPlaCantPlan     += Convert.ToInt32(row.Cells[4].Text);
                            CantPlanBajo         += Convert.ToInt32(row.Cells[4].Text);
                            TotalPlaCantPlanBajo += Convert.ToInt32(row.Cells[4].Text);
                            CantProdBajo         += Convert.ToInt32(row.Cells[5].Text);
                            TotalPlaCantProdBajo += Convert.ToInt32(row.Cells[5].Text);
                        }
                    }
                }
                string CantidadDif = (CantProdSobre - CantPlanSobre).ToString();
                string PorcenProd  = (Convert.ToDouble(Convert.ToDouble(CantidadDif) / Convert.ToDouble(CantPlanSobre)) * 100).ToString("N2") + "%";

                Label  TablaMaquinaTotal = new Label();
                string Negativo          = "";
                if (CantPlanBajo > 0)
                {
                    string CantidadDifNeg = (CantProdBajo - CantPlanBajo).ToString();
                    string PorcenProdNeg  = (Convert.ToDouble(Convert.ToDouble(CantidadDifNeg) / Convert.ToDouble(CantPlanBajo)) * 100).ToString("N2") + "%";
                    Negativo = "<tr><td colspan ='8'></td><td style='border:1px solid black;'>Cant. Plan. Bajo</td>" +
                               "<td style='border:1px solid black;'>" + CantPlanBajo.ToString() + "</td></tr><tr>" +
                               "<td colspan ='8'></td><td style='border:1px solid black;'>Cant. Prod. Bajo</td>" +
                               "<td style='border:1px solid black;'>" + CantProdBajo.ToString() + "</td></tr><tr>" +
                               "<td colspan ='8'></td><td style='border:1px solid black;'>Diferencia Bajo</td>" +
                               "<td style='border:1px solid black;'>" + CantidadDifNeg + "</td></tr><tr>" +
                               "<td colspan ='8'></td><td style='border:1px solid black;'>% Bajo</td>" +
                               "<td style='border:1px solid black;'>" + PorcenProdNeg + "</td></tr>";
                }
                TablaMaquinaTotal.Text = "<br/><div align='right'><table><tr>" +
                                         "<td colspan ='8'></td><td  style='border:1px solid black;'>Total Cant. Plan.</td>" +
                                         "<td style='border:1px solid black;'>" + TotalPlanificado.ToString() + "</div></td></tr><tr>" +
                                         "<td colspan ='8'></td><td  style='border:1px solid black;'>Cant. Plan. Sobre</td>" +
                                         "<td style='border:1px solid black;'>" + CantPlanSobre.ToString() + "</div></td></tr><tr>" +
                                         "<td colspan ='8'></td><td style='border:1px solid black;'>Cant. Prod. Sobre</td>" +
                                         "<td style='border:1px solid black;'>" + CantProdSobre.ToString() + "</td></tr><tr>" +
                                         "<td colspan ='8'></td><td style='border:1px solid black;'>Diferencia Sobre</td>" +
                                         "<td style='border:1px solid black;'>" + CantidadDif + "</td></tr><tr>" +
                                         "<td colspan ='8'></td><td style='border:1px solid black;'>% Sobre</td>" +
                                         "<td style='border:1px solid black;'>" + PorcenProd.Replace("NaN", "0") + "</td></tr>" + Negativo + "</table></div>";

                Label Maquina1 = new Label();
                if (contado == 0)
                {
                    Maquina1.Text = "<div align='left'>" + maquinasProd + " </div><br/>";
                }
                else
                {
                    Maquina1.Text = "<br/><div align='left'>" + maquinasProd + " </div><br/>";
                }
                form.Controls.Add(Maquina1);
                form.Controls.Add(gv);
                form.Controls.Add(TablaMaquinaTotal);
                contado++;
            }
            #endregion

            Label TablaMaquinaRot = new Label();
            TotalRotCantDifSobre = (TotalRotCantProdSobre - TotalRotCantPlanSobre);
            RotPorceCantDifSobre = Convert.ToDouble(Convert.ToDouble(TotalRotCantDifSobre) / Convert.ToDouble(TotalRotCantPlanSobre)) * 100;
            TotalRotCantDifBajo  = (TotalRotCantPlanBajo - TotalRotCantProdBajo);

            string RotNegativoBajo = "";
            if (TotalRotCantDifBajo > 0)
            {
                RotPorceCantDifBajo = Convert.ToDouble(Convert.ToDouble(TotalRotCantDifBajo) / Convert.ToDouble(TotalRotCantPlanBajo)) * 100;
                RotNegativoBajo     = "<tr><td colspan ='8'></td><td  style='border:1px solid black;'>Cant. Plan. Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalRotCantPlanBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='8'></td><td  style='border:1px solid black;'>Cant. Prod. Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalRotCantProdBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='8'></td><td  style='border:1px solid black;'>Diferencia Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalRotCantDifBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='8'></td><td  style='border:1px solid black;'>% Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + RotPorceCantDifBajo.ToString() + "%</td></tr>";
            }
            TablaMaquinaRot.Text = "<br/><br/><br/><div align='right'><table><tr>" +
                                   "<td colspan ='8'></td><td  style='border:1px solid black;'colspan ='2'>Rotativa</td></tr><tr>" +
                                   "<td colspan ='8'></td><td  style='border:1px solid black;'>Total Cant. Plan.</td>" +
                                   "<td style='border:1px solid black;'>" + TotalRotCantPlan.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='8'></td><td  style='border:1px solid black;'>Cant. Plan. Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalRotCantPlanSobre.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='8'></td><td style='border:1px solid black;'>Cant. Prod. Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalRotCantProdSobre.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='8'></td><td style='border:1px solid black;'>Diferencia Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalRotCantDifSobre + "</td></tr><tr>" +
                                   "<td colspan ='8'></td><td style='border:1px solid black;'>% Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + RotPorceCantDifSobre.ToString("N2").Replace("NaN", "0") + "%</td></tr>" +
                                   RotNegativoBajo + "</table></div>";

            form.Controls.Add(TablaMaquinaRot);

            Label TablaMaquinaPla = new Label();
            TotalPlaCantDifSobre = (TotalPlaCantProdSobre - TotalPlaCantPlanSobre);
            TotalPlaCantDifbajo  = (TotalPlaCantPlanBajo - TotalPlaCantProdBajo);
            PlaPorceCantDifSobre = Convert.ToDouble(Convert.ToDouble(TotalPlaCantDifSobre) / Convert.ToDouble(TotalPlaCantPlanSobre)) * 100;

            string PlaNegativoBajo = "";
            if (TotalPlaCantDifbajo > 0)
            {
                PlaPorceCantDifBajo = Convert.ToDouble(Convert.ToDouble(TotalPlaCantDifbajo) / Convert.ToDouble(TotalPlaCantPlanBajo)) * 100;
                PlaNegativoBajo     = "<tr><td colspan ='8'></td><td  style='border:1px solid black;'>Cant. Plan. Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalPlaCantPlanBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='8'></td><td  style='border:1px solid black;'>Cant. Prod. Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalPlaCantProdBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='8'></td><td  style='border:1px solid black;'>Diferencia Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalPlaCantDifbajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='8'></td><td  style='border:1px solid black;'>% Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + PlaPorceCantDifBajo.ToString() + "%</td></tr>";
            }
            TablaMaquinaPla.Text = "<br/><div align='right'><table><tr>" +
                                   "<td colspan ='8'></td><td  style='border:1px solid black;' colspan ='2'>Plana</td></tr><tr>" +
                                   "<td colspan ='8'></td><td  style='border:1px solid black;'>Total Cant. Plan.</td>" + // colspan ='2'
                                   "<td style='border:1px solid black;'>" + TotalPlaCantPlan.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='8'></td><td  style='border:1px solid black;'>Cant. Plan. Sobre</td>" + // colspan ='2'
                                   "<td style='border:1px solid black;'>" + TotalPlaCantPlanSobre.ToString() + "</div></td></tr><tr>" +
                                   "<td colspan ='8'></td><td style='border:1px solid black;'>Cant. Prod. Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalPlaCantProdSobre.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='8'></td><td style='border:1px solid black;'>Diferencia Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalPlaCantDifSobre + "</td></tr><tr>" +
                                   "<td colspan ='8'></td><td style='border:1px solid black;'>% Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + PlaPorceCantDifSobre.ToString("N2") + "%</td></tr>" +
                                   PlaNegativoBajo + "</table></div>";

            form.Controls.Add(TablaMaquinaPla);

            pageToRender.Controls.Add(form);
            response.Clear();
            response.Buffer      = true;
            response.ContentType = "application/vnd.ms-excel";
            response.AddHeader("Content-Disposition", "attachment;filename=" + nameReport + ".xls");
            response.Charset         = "UTF-8";
            response.ContentEncoding = Encoding.Default;
            pageToRender.RenderControl(htw);


            response.Write(sw.ToString());
            response.End();
        }