コード例 #1
0
 protected void grvwContract_RowDataBound(Object sender, GridViewRowEventArgs e)
 {
     //Add Exception handilng try catch change by vishal 21-05-2012
     try
     {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             // Hndling GridView RowDataBound  Event for Binding vendorid to Vendor name
             int vendorid = Convert.ToInt32(e.Row.Cells[5].Text);
             objVendor           = objVendor.Get_By_id(vendorid);
             e.Row.Cells[5].Text = objVendor.Vendorname.ToString();
             int contractid = Convert.ToInt32(e.Row.Cells[1].Text);
             objContract = objContract.Get_By_id(contractid);
             int   TotalSpentTimeInMins = objContract.Get_Contract_Status(objContract.Activeto);
             Label lbl = ((Label)e.Row.FindControl("lblActive"));
             if (TotalSpentTimeInMins > 0)
             {
                 lbl.Text = "Active";
             }
             else
             {
                 lbl.Text = "Not Active";
             }
         }
     }
     catch (Exception ex)
     {
         string myScript;
         myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
         Page.RegisterClientScriptBlock("MyScript", myScript);
         return;
     }
 }
    protected void BindContractData()
    {
        int contractid = Convert.ToInt16(Request.QueryString[0]);

        objContract = objContract.Get_By_id(contractid);
        if (objContract != null)
        {
            txtContractName.Text = objContract.Contractname + " " + "Renewed";
            txtdesc.Text         = objContract.Description;

            drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid);

            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            ListAsset.DataTextField  = "computername";
            ListAsset.DataValueField = "Assetid";
            ListAsset.DataSource     = colAsset;
            ListAsset.DataBind();
        }

        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst();
            chkLevel1.Checked  = true;
            txtBeforeDays.Text = objContractNotfy.Beforedays.ToString();
            string   varEmail = objContractNotfy.Sentto;
            string[] arrEmail = varEmail.Split((",").ToCharArray());
            for (int i = 0; i < arrEmail.Length - 1; i++)
            {
                if (arrEmail[i] != "," && arrEmail[i] != " ")
                {
                    objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]);
                    for (int j = listLevel1.Items.Count - 1; j >= 0; j--)
                    {
                        if (Convert.ToInt16(listLevel1.Items[j].Value) == objEscalateEmail.Id)
                        {
                            listLevel1.Items[j].Selected = true;
                        }
                    }
                }
            }
        }
    }
    protected void BindContract()
    {
        int contractid = Convert.ToInt16(Request.QueryString[0]);
        objContract = objContract.Get_By_id(contractid);
        if (objContract!=null )
        {
            lblContractName.Text = objContract.Contractname;
            lblContractId.Text = objContract.Contractid.ToString();
            lblActiveFrom.Text = objContract.Activefrom.ToString();
            lblActiveTo.Text  = objContract.Activeto.ToString();
            objVendor = objVendor.Get_By_id(objContract.Vendorid);
            lblVendorname.Text = objVendor.Vendorname.ToString();
            lblDesc.Text = objContract.Description.ToString();
            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            grdvwViewAsset.DataSource = colAsset;
            grdvwViewAsset.DataBind();
        }
        objConRenewed = objConRenewed.Get_By_id(contractid);
        if (objConRenewed.Contractid!=0)
        {
            lblRen.Visible = true;
            Contract_mst obj = new Contract_mst();
            obj = obj.Get_By_id(objConRenewed.Contractid);
            lblRenInfo.Text = obj.Contractname;
            lblRenInfo.Visible = true;

        }
        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            lblUsers.Text = objContractNotfy.Sentto;
            lblDays.Text = Convert.ToString(objContractNotfy.Beforedays);

        }
        else
        {
            lblUsers.Text = "-";
            lblDays.Text = "-";

        }
    }
コード例 #4
0
    protected void BindContract()
    {
        int contractid = Convert.ToInt16(Request.QueryString[0]);

        objContract = objContract.Get_By_id(contractid);
        if (objContract != null)
        {
            lblContractName.Text      = objContract.Contractname;
            lblContractId.Text        = objContract.Contractid.ToString();
            lblActiveFrom.Text        = objContract.Activefrom.ToString();
            lblActiveTo.Text          = objContract.Activeto.ToString();
            objVendor                 = objVendor.Get_By_id(objContract.Vendorid);
            lblVendorname.Text        = objVendor.Vendorname.ToString();
            lblDesc.Text              = objContract.Description.ToString();
            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            grdvwViewAsset.DataSource = colAsset;
            grdvwViewAsset.DataBind();
        }
        objConRenewed = objConRenewed.Get_By_id(contractid);
        if (objConRenewed.Contractid != 0)
        {
            lblRen.Visible = true;
            Contract_mst obj = new Contract_mst();
            obj                = obj.Get_By_id(objConRenewed.Contractid);
            lblRenInfo.Text    = obj.Contractname;
            lblRenInfo.Visible = true;
        }
        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            lblUsers.Text = objContractNotfy.Sentto;
            lblDays.Text  = Convert.ToString(objContractNotfy.Beforedays);
        }
        else
        {
            lblUsers.Text = "-";
            lblDays.Text  = "-";
        }
    }
コード例 #5
0
 protected void grvwContract_RowDataBound(Object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         // Hndling GridView RowDataBound  Event for Binding vendorid to Vendor name
         int vendorid = Convert.ToInt16(e.Row.Cells[5].Text);
         objVendor           = objVendor.Get_By_id(vendorid);
         e.Row.Cells[5].Text = objVendor.Vendorname.ToString();
         int contractid = Convert.ToInt16(e.Row.Cells[1].Text);
         objContract = objContract.Get_By_id(contractid);
         int   TotalSpentTimeInMins = objContract.Get_Contract_Status(objContract.Activeto);
         Label lbl = ((Label)e.Row.FindControl("lblActive"));
         if (TotalSpentTimeInMins > 0)
         {
             lbl.Text = "Active";
         }
         else
         {
             lbl.Text = "Not Active";
         }
     }
 }
    protected void BindContractData()
    {
        int contractid = Convert.ToInt32(Request.QueryString[0]);

        objContract = objContract.Get_By_id(contractid);
        if (objContract != null)
        {
            string dd;
            string mm;
            string yy;
            txtContractName.Text = objContract.Contractname;
            txtdesc.Text         = objContract.Description.ToString();
            string[] tempdate = objContract.Activefrom.ToString().Split(("/").ToCharArray());
            string   StrData  = tempdate[2].ToString();
            string[] temp1    = StrData.Split((" ").ToCharArray());

            if (Convert.ToInt32(tempdate[1]) < 10)
            {
                dd = "0" + tempdate[1];
            }
            else
            {
                dd = tempdate[1];
            }
            if (Convert.ToInt32(tempdate[0]) < 10)
            {
                mm = "0" + tempdate[0];
            }
            else
            {
                mm = tempdate[0];
            }
            string vardateFrom = dd + "/" + mm + "/" + temp1[0];
            txtActiveFrom.Text = vardateFrom;


            string[] tempdate1 = objContract.Activeto.ToString().Split(("/").ToCharArray());
            string   StrData1  = tempdate1[2].ToString();
            string[] temp2     = StrData1.Split((" ").ToCharArray());

            if (Convert.ToInt32(tempdate1[1]) < 10)
            {
                dd = "0" + tempdate1[1];
            }
            else
            {
                dd = tempdate1[1];
            }
            if (Convert.ToInt32(tempdate1[0]) < 10)
            {
                mm = "0" + tempdate1[0];
            }
            else
            {
                mm = tempdate1[0];
            }
            string vardateTo = dd + "/" + mm + "/" + temp2[0];


            txtActiveTo.Text        = vardateTo;
            drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid);

            colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid);
            foreach (ContractToAssetMapping obj in colContractToAssetMapping)
            {
                Asset_mst objA = new Asset_mst();
                objA = objA.Get_By_id(obj.Assetid);
                colAsset.Add(objA);
            }
            ListAsset.DataTextField  = "computername";
            ListAsset.DataValueField = "Assetid";
            ListAsset.DataSource     = colAsset;
            ListAsset.DataBind();
        }

        objContractNotfy = objContractNotfy.Get_By_id(contractid);
        if (objContractNotfy.Contractid != 0)
        {
            EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst();
            chkLevel1.Checked  = true;
            txtBeforeDays.Text = objContractNotfy.Beforedays.ToString();
            string   varEmail = objContractNotfy.Sentto;
            string[] arrEmail = varEmail.Split((",").ToCharArray());
            for (int i = 0; i < arrEmail.Length - 1; i++)
            {
                if (arrEmail[i] != "," && arrEmail[i] != " ")
                {
                    objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]);
                    for (int j = listLevel1.Items.Count - 1; j >= 0; j--)
                    {
                        if (Convert.ToInt32(listLevel1.Items[j].Value) == objEscalateEmail.Id)
                        {
                            listLevel1.Items[j].Selected = true;
                        }
                    }
                }
            }
        }
    }