Ejemplo n.º 1
0
    protected void grdprod_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow && e.Row.DataItem != null)
        {
            try
            {
                GridViewRow gr = e.Row;
                Label lblprodname = (Label)gr.FindControl("lblProdname");
                Label lblProdctg = (Label)gr.FindControl("lblProdctg");
                Label lblProdcomp = (Label)gr.FindControl("lblProdcomp");
                Label lblProdtype = (Label)gr.FindControl("lblProdtype");
                Label lblProdsupp = (Label)gr.FindControl("lblProdsupp");
                Label lblProdmedicinefor = (Label)gr.FindControl("lblProdmedicinefor");
                Label lblProdPcost = (Label)gr.FindControl("lblProdPcost");
                Label lblProdScost = (Label)gr.FindControl("lblProdScost");
                Label lblProdoffer = (Label)gr.FindControl("lblProdoffer");
                HiddenField HDFID = (HiddenField)gr.FindControl("HDFProdID");
                ImageButton IMGBTNcategoryisActive = (ImageButton)gr.FindControl("IMGBTNProdisActive");
                Image IMGProd = (Image)gr.FindControl("IMGProd");
                ProdTable u = e.Row.DataItem as ProdTable;
                objitem = null;
                objitem = ObjprodClass.GetItemsByID(Convert.ToInt32(u.ItemId));
                if (objitem != null)
                {
                    objitempurchase = ObjprodClass.GetItempurchaseByID(Convert.ToInt32(u.PurchaseId));
                    objitemsell = ObjprodClass.GetItemsellByID(Convert.ToInt32(u.SellId));
                    objprodctg = ObjprodClass.GetProdSubcategoryByID(Convert.ToInt32(u.CategoryId));
                    objprodtype = ObjprodClass.GetProdTypeByID(Convert.ToInt32(u.TypeId));
                    objprodsupple = ObjprodClass.GetProdsupplymentByID(Convert.ToInt32(u.SupplementId));
                    Objprodcomp = ObjprodClass.GetProdcompByID(Convert.ToInt32(u.CompanyId));
                    objmed = ObjprodClass.GetProdmedicineByID(Convert.ToInt32(u.MedicineForId));
                    objoffer = ObjprodClass.GetProdOfferByID(Convert.ToInt32(u.OfferId));
                    if (objitempurchase != null && objitemsell != null & objprodctg != null
                        && objprodtype != null & objprodsupple != null && Objprodcomp != null
                        & objmed != null && objoffer != null)
                    {
                        lblprodname.Text = objitem.ItemName.ToString().Trim();
                        lblProdctg.Text = objprodctg.SubCategoryName.ToString().Trim();
                        lblProdtype.Text = objprodtype.Name.ToString().Trim();
                        lblProdsupp.Text = objprodsupple.Name.ToString().Trim();
                        lblProdcomp.Text = Objprodcomp.CompanyName.ToString().Trim();
                        lblProdmedicinefor.Text = objmed.Name.ToString().Trim();
                        lblProdoffer.Text = objoffer.OfferPercent.ToString().Trim();
                        lblProdPcost.Text = objitempurchase.Cost.ToString().Trim();
                        lblProdScost.Text = objitemsell.Cost.ToString().Trim();
                        HDFID.Value = u.Id.ToString();
                        IMGProd.ImageUrl = u.ImageUrl;

                        if (u.IsActive == true)
                        {
                            IMGBTNcategoryisActive.ImageUrl = "~/images/tick.png";
                        }
                        else
                            IMGBTNcategoryisActive.ImageUrl = "~/images/close.jpg";
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
    }
Ejemplo n.º 2
0
 public ProdCompany GetProdcompByID(int id)
 {
     objprodcomp = null;
     objprodcomp = DataRepository.ProdCompanyProvider.GetById(id);
     return objprodcomp;
 }
Ejemplo n.º 3
0
    protected void btnsubmitcompany_Click1(object sender, EventArgs e)
    {
        string compname = txtcompname.Text;
        if (compname != null)
        {
            objprodcomp.CompanyName = compname.ToString();
            objprodcomp.CreatedDate = DateTime.Now;
            switch (btnsubmitcompany.Text.Trim())
            {
                case "Submit":
                    ViewState["popupID"] = null;
                    Status = ObjprodClass.insertProdCompany(objprodcomp);
                    if (Status == "Information Insert successfully.")
                    {
                        errorpopupcompany.Visible = true;
                        errorpopupcompany.Style.Add("display", "block");
                        errorpopupcompany.Attributes.Add("class", "fk-msg-success");
                        errorpopupcompany.InnerHtml = "Productcompany Inserted successfully";
                        BindProdCompanyGrid();
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPCompany('true');});", true);
                    }
                    else
                    {
                        errorpopupcompany.Visible = true;
                        errorpopupcompany.Style.Add("display", "block");
                        errorpopupcompany.Attributes.Add("class", "fk-err-all");
                        errorpopupcompany.InnerHtml = Status;
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPCompany('true');});", true);
                    }
                    break;
                case "Update":
                    if (ViewState["popupID"] != null && ViewState["popupID"] != "")
                    {
                        objprodcomp = null;
                        objprodcomp = ObjprodClass.GetProdcompByID(Convert.ToInt32(ViewState["popupID"]));
                        objprodcomp.CompanyName = compname.ToString();
                        if (chkisactivecomp.Checked)
                            objprodcomp.IsActive = true;
                        else
                            objprodcomp.IsActive = false;
                        Status = ObjprodClass.UpdateProdCompany(objprodcomp);
                        if (Status == "Information Update successfully.")
                        {
                            errorpopupcompany.Visible = true;
                            errorpopupcompany.Style.Add("display", "block");
                            errorpopupcompany.Attributes.Add("class", "fk-msg-success");
                            errorpopupcompany.InnerHtml = "Productcompany Updated successfully";
                            BindProdCompanyGrid();
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPUpdatecomp('true');});", true);
                        }
                        else
                        {
                            errorpopupcompany.Visible = true;
                            errorpopupcompany.Style.Add("display", "block");
                            errorpopupcompany.Attributes.Add("class", "fk-err-all");
                            errorpopupcompany.InnerHtml = Status;
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPUpdatecomp('true');});", true);
                        }
                    }
                    break;
            }


        }
    }
Ejemplo n.º 4
0
 public string UpdateProdCompany(ProdCompany orduser)
 {
     TransactionManager transaction = null;
     try
     {
         transaction = DataRepository.Provider.CreateTransaction();
         transaction.BeginTransaction();
         if (DataRepository.ProdCompanyProvider.Update(orduser))
         {
             // Show proper message
         }
         else
         {
             return "Information could not be saved.";
         }
         transaction.Commit();
         return "Information Update successfully.";
     }
     catch (Exception e)
     {
         transaction.Rollback();
         return "Information could not be saved.Please contact Administrator.";
     }
 }
Ejemplo n.º 5
0
 protected void IMGBTNcompanyisActive_Click(object sender, ImageClickEventArgs e)
 {
     ImageButton lnk = (ImageButton)sender;
     int userid = Convert.ToInt32(lnk.CommandArgument);
     objprodcomp = null;
     objprodcomp = ObjprodClass.GetProdcompByID(userid);
     if (objprodcomp != null)
     {
         if (objprodcomp.IsActive == true)
             chkisactivecomp.Checked = true;
         txtcompname.Text = "";
         txtcompname.Text = objprodcomp.CompanyName;
         errorpopupcompany.Style.Add("display", "none");
         DIVIsActivecomp.Style.Add("display", "block");
         btnsubmitcompany.Text = "Update";
         ViewState["popupID"] = userid.ToString();
         ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPUpdatecomp('true');});", true);
     }
 }