Exemplo n.º 1
0
 internal int Saveproject(MRK_Project aMRK_Project)
 {
     try
     {
         using (var _context = new ERPSSL_Marketing_Entities())
         {
             _context.MRK_Project.AddObject(aMRK_Project);
             _context.SaveChanges();
             return(aMRK_Project.ProjectId);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 internal int Saveproject(MRK_Project aMRK_Project)
 {
     return(aMarketingInfoDAL.Saveproject(aMRK_Project));
 }
Exemplo n.º 3
0
        protected void submitButton_Click(object sender, EventArgs e)
        {
            try
            {
                //Reference---------------------------------
                if (referenceCheckBox.Checked == true)
                {
                    MRK_Reference aMRK_Reference = new MRK_Reference();
                    aMRK_Reference.ReferenceName   = referenceTextBox.Text;
                    aMRK_Reference.ReferenceNumber = "";
                    aMRK_Reference.Create_User     = ((SessionUser)Session["SessionUser"]).UserId;
                    aMRK_Reference.Create_Date     = DateTime.Now;
                    aMRK_Reference.OCODE           = ((SessionUser)Session["SessionUser"]).OCode;

                    currentReferenceId = aMarketingInfoBLL.Savereference(aMRK_Reference);
                }
                else
                {
                    currentReferenceId = Convert.ToInt32(referenceDropDownList.SelectedValue.ToString());
                }


                //Project-----------------------------------------
                if (projectCheckBox.Checked == true)
                {
                    MRK_Project aMRK_Project = new MRK_Project();
                    aMRK_Project.ProjectName = projectTextBox.Text;
                    aMRK_Project.Create_User = ((SessionUser)Session["SessionUser"]).UserId;
                    aMRK_Project.Create_Date = DateTime.Now;
                    aMRK_Project.OCODE       = ((SessionUser)Session["SessionUser"]).OCode;

                    currentProjectId = aMarketingInfoBLL.Saveproject(aMRK_Project);
                }
                else
                {
                    currentProjectId = Convert.ToInt32(projectDropDownList.SelectedValue.ToString());
                }



                if (visitDateTextBox.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Visit Date')", true);
                    return;
                }
                else if (clientNameTextBox.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input Client Name!')", true);
                }
                else if (contactNumberTextBox.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input Contact Number!')", true);
                }
                else if (projectDropDownList.Text == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Project!')", true);
                }
                else if (stageDropDownList.Text == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Stage!')", true);
                }
                else
                {
                    if (submitButton.Text == "Submit")
                    {
                        MRK_MarketingInfo aMRK_MarketingInfo = new MRK_MarketingInfo();
                        aMRK_MarketingInfo.VisitDate         = Convert.ToDateTime(visitDateTextBox.Text);
                        aMRK_MarketingInfo.Client            = clientNameTextBox.Text;
                        aMRK_MarketingInfo.ContactPerson     = contactPersonTextBox.Text;
                        aMRK_MarketingInfo.Designation       = designationTextBox.Text;
                        aMRK_MarketingInfo.ContactNumber     = contactNumberTextBox.Text;
                        aMRK_MarketingInfo.Email             = emailTextBox.Text;
                        aMRK_MarketingInfo.Address           = addressTextBox.Text;
                        aMRK_MarketingInfo.ProjectId         = currentProjectId;
                        aMRK_MarketingInfo.Module            = moduleTextBox.Text;
                        aMRK_MarketingInfo.StageId           = Convert.ToInt32(stageDropDownList.SelectedValue.ToString());
                        aMRK_MarketingInfo.MarketingPersonId = marketingPersonDropDownList.SelectedValue.ToString();
                        aMRK_MarketingInfo.ReferenceId       = currentReferenceId;
                        aMRK_MarketingInfo.Remarks           = remarksTextBox.Text;
                        aMRK_MarketingInfo.Create_User       = ((SessionUser)Session["SessionUser"]).UserId;
                        aMRK_MarketingInfo.Create_Date       = DateTime.Now;
                        aMRK_MarketingInfo.OCODE             = ((SessionUser)Session["SessionUser"]).OCode;

                        int result = aMarketingInfoBLL.SaveMarketingInfo(aMRK_MarketingInfo);


                        if (result == 1)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true);
                        }
                    }
                    else if (submitButton.Text == "Update")
                    {
                        MRK_MarketingInfo aMRK_MarketingInfo = new MRK_MarketingInfo();
                        aMRK_MarketingInfo.VisitDate         = Convert.ToDateTime(visitDateTextBox.Text);
                        aMRK_MarketingInfo.Client            = clientNameTextBox.Text;
                        aMRK_MarketingInfo.ContactPerson     = contactPersonTextBox.Text;
                        aMRK_MarketingInfo.Designation       = designationTextBox.Text;
                        aMRK_MarketingInfo.ContactNumber     = contactNumberTextBox.Text;
                        aMRK_MarketingInfo.Email             = emailTextBox.Text;
                        aMRK_MarketingInfo.Address           = addressTextBox.Text;
                        aMRK_MarketingInfo.ProjectId         = currentProjectId;
                        aMRK_MarketingInfo.Module            = moduleTextBox.Text;
                        aMRK_MarketingInfo.StageId           = Convert.ToInt32(stageDropDownList.SelectedValue.ToString());
                        aMRK_MarketingInfo.MarketingPersonId = marketingPersonDropDownList.SelectedValue.ToString();
                        aMRK_MarketingInfo.ReferenceId       = currentReferenceId;
                        aMRK_MarketingInfo.Remarks           = remarksTextBox.Text;
                        aMRK_MarketingInfo.Edit_User         = ((SessionUser)Session["SessionUser"]).UserId;
                        aMRK_MarketingInfo.Edit_Date         = DateTime.Now;
                        aMRK_MarketingInfo.OCODE             = ((SessionUser)Session["SessionUser"]).OCode;

                        int marketingInfoId = Convert.ToInt16(hidMarketingInfoId.Value);
                        int result          = aMarketingInfoBLL.UpdateMarketingInfo(aMRK_MarketingInfo, marketingInfoId);
                        if (result == 1)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                            GetMarketingInfoGridView();
                            string OCODE = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode);
                        }
                    }

                    ClearAllControl();


                    referenceCheckBox.Checked     = false;
                    referenceTextBox.Visible      = false;
                    referenceDropDownList.Visible = true;

                    projectCheckBox.Checked     = false;
                    projectTextBox.Visible      = false;
                    projectDropDownList.Visible = true;
                }
                GetMarketingInfoGridView();
            }
            catch (Exception ex)
            {
                string EID = Convert.ToString(((SessionUser)Session["SessionUser"]).EID);
                //LogController<officeSetup>.SetLog(ex, EID);
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }