Esempio n. 1
0
        public int InsertmContactType(mContactType ct, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));

            ce.mContactTypes.AddObject(ct);
            ce.SaveChanges();
            return(1);
        }
Esempio n. 2
0
        public int UpdatemContactType(mContactType updatect, string[] conn)
        {
            BISPL_CRMDBEntities ce = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));

            ce.mContactTypes.Attach(updatect);
            ce.ObjectStateManager.ChangeObjectState(updatect, EntityState.Modified);
            ce.SaveChanges();
            return(1);
        }
Esempio n. 3
0
        /// <summary>
        /// GetLeadSourceList is providing List of LeadSource
        /// </summary>
        /// <returns></returns>
        ///

        public mContactType GetContactTypeListByID(int ContactTypeId, string[] conn)
        {
            BISPL_CRMDBEntities ce           = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn));
            mContactType        ContactType1 = new mContactType();

            ContactType1 = (from p in ce.mContactTypes
                            where p.ID == ContactTypeId
                            select p).FirstOrDefault();
            ce.Detach(ContactType1);
            return(ContactType1);
        }
        protected void pageSave(Object sender, BrilliantWMS.ToolbarService.iUCToolbarClient e)
        {
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                if (checkDuplicate() == "")
                {
                    mContactType ObjContactType = new mContactType();
                    if (hdnContactTypeID.Value == string.Empty)
                    {
                        ObjContactType.ContactType = txtContactType.Text;
                        if (txtSequence.Text == string.Empty)
                        {
                            ObjContactType.Sequence = 0;
                        }
                        else
                        {
                            ObjContactType.Sequence = Convert.ToInt64(txtSequence.Text);
                        }
                        if (rbtnYes.Checked == true)
                        {
                            ObjContactType.Active = "Y";
                        }
                        else
                        {
                            ObjContactType.Active = "N";
                        }
                        ObjContactType.CreatedBy    = profile.Personal.UserID.ToString();
                        ObjContactType.CreationDate = DateTime.Now;

                        ObjContactType.Remark    = txtRemark.Text;
                        ObjContactType.CompanyID = profile.Personal.CompanyID;
                        int result = ContactTypeClient.InsertmContactType(ObjContactType, profile.DBConnection._constr);
                        if (result == 1)
                        {
                            WebMsgBox.MsgBox.Show("Record saved successfully");
                        }
                        BindGrid();
                        clear();
                    }
                    else
                    {
                        ObjContactType             = ContactTypeClient.GetContactTypeListByID(Convert.ToInt32(hdnContactTypeID.Value), profile.DBConnection._constr);
                        ObjContactType.ContactType = txtContactType.Text;
                        ObjContactType.Remark      = txtRemark.Text;
                        if (txtSequence.Text == string.Empty)
                        {
                            ObjContactType.Sequence = 0;
                        }
                        else
                        {
                            ObjContactType.Sequence = Convert.ToInt64(txtSequence.Text);
                        }
                        if (rbtnYes.Checked == true)
                        {
                            ObjContactType.Active = "Y";
                        }
                        else
                        {
                            ObjContactType.Active = "N";
                        }
                        ObjContactType.LastModifiedBy   = profile.Personal.UserID.ToString();
                        ObjContactType.LastModifiedDate = DateTime.Now;
                        int result = ContactTypeClient.UpdatemContactType(ObjContactType, profile.DBConnection._constr);
                        if (result == 1)
                        {
                            WebMsgBox.MsgBox.Show("Record updated successfully");
                        }
                        BindGrid();
                        clear();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, Page, "Contact Type Master", "pageSave");
            }
            finally
            {
            }
        }