Exemple #1
0
 protected void BtnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         int DeleteId = 0;
         if (ViewState["EditID"] != null)
         {
             DeleteId = Convert.ToInt32(ViewState["EditID"]);
         }
         if (DeleteId != 0)
         {
             Entity_PR.SalutationId = DeleteId;
             Entity_PR.LoginId      = Convert.ToInt32(Session["UserID"]);
             Entity_PR.LoginDate    = DateTime.Now;
             int iDelete = Obj_PR.DeleteRecord(ref Entity_PR, out StrError);
             if (iDelete != 0)
             {
                 obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page);
                 MakeEmptyForm();
             }
         }
         Entity_PR = null;
         obj_Comm  = null;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemple #2
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        int UpdateRow = 0;

        try
        {
            if (ViewState["EditID"] != null)
            {
                Entity_PR.SalutationId = Convert.ToInt32(ViewState["EditID"]);
            }
            Entity_PR.Salutation = TxtSalutation.Text.Trim();
            Entity_PR.LoginId    = Convert.ToInt32(Session["UserId"]);
            Entity_PR.LoginDate  = DateTime.Now;
            UpdateRow            = Obj_PR.UpdateRecord(ref Entity_PR, out StrError);
            if (UpdateRow != 0)
            {
                obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page);
                MakeEmptyForm();
                Entity_PR = null;
                obj_Comm  = null;
            }
        }

        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Exemple #3
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0;

        try
        {
            DS = Obj_PR.ChkDuplicate(TxtSalutation.Text.Trim(), out StrError);
            if (DS.Tables[0].Rows.Count > 0)
            {
                obj_Comm.ShowPopUpMsg("Salutation Already Exist..!", this.Page);
                TxtSalutation.Focus();
            }
            else
            {
                Entity_PR.Salutation = TxtSalutation.Text.Trim();
                Entity_PR.LoginId    = Convert.ToInt32(Session["UserId"]);
                Entity_PR.LoginDate  = DateTime.Now;
                InsertRow            = Obj_PR.InsertRecord(ref Entity_PR, out StrError);

                if (InsertRow != 0)
                {
                    obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page);
                    MakeEmptyForm();
                    Entity_PR = null;
                    obj_Comm  = null;
                }
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Exemple #4
0
        public int InsertRecord(ref SalutationMaster Entity_call, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction      = new SqlParameter(SalutationMaster._Action, SqlDbType.BigInt);
                SqlParameter pSalutation  = new SqlParameter(SalutationMaster._Salutation, SqlDbType.NVarChar);
                SqlParameter pCreatedBy   = new SqlParameter(SalutationMaster._LoginId, SqlDbType.BigInt);
                SqlParameter PCreatedDate = new SqlParameter(SalutationMaster._LoginDate, SqlDbType.DateTime);

                pAction.Value      = 1;
                pSalutation.Value  = Entity_call.Salutation;
                pCreatedBy.Value   = Entity_call.LoginId;
                PCreatedDate.Value = Entity_call.LoginDate;

                SqlParameter[] param = new SqlParameter[] { pAction, pSalutation, pCreatedBy, PCreatedDate };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteScalar(_Connection, _Transaction, CommandType.StoredProcedure, SalutationMaster.SP_SalutationMaster, param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }

            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }

            finally
            {
                Close();
            }
            return(iInsert);
        }
Exemple #5
0
        public int DeleteRecord(ref SalutationMaster EntityCall, out string StrError)
        {
            int iDelete = 0;

            StrError = string.Empty;
            try
            {
                SqlParameter pAction       = new SqlParameter(SalutationMaster._Action, SqlDbType.BigInt);
                SqlParameter pSalutationId = new SqlParameter(SalutationMaster._SalutationId, SqlDbType.BigInt);
                SqlParameter pDeletedBy    = new SqlParameter(SalutationMaster._LoginId, SqlDbType.BigInt);
                SqlParameter pDeletedDate  = new SqlParameter(SalutationMaster._LoginDate, SqlDbType.DateTime);
                pAction.Value       = 3;
                pSalutationId.Value = EntityCall.SalutationId;
                pDeletedBy.Value    = EntityCall.LoginId;
                pDeletedDate.Value  = EntityCall.LoginDate;

                SqlParameter[] param = new SqlParameter[] { pAction, pSalutationId, pDeletedBy, pDeletedDate };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iDelete = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, SalutationMaster.SP_SalutationMaster, param);

                if (iDelete > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                StrError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iDelete);
        }