示例#1
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        int i = Convert.ToInt32(hiddenbox.Value);

        if (i == 0)
        {
            int UpdateRow = 0;
            try
            {
                if (ViewState["EditID"] != null)
                {
                    Entity_FlatType.FlatTypeId = Convert.ToInt32(ViewState["EditID"]);
                }
                Entity_FlatType.FlatType = txtFlatType.Text.Trim();

                Entity_FlatType.UserId    = Convert.ToInt32(Session["UserId"]);
                Entity_FlatType.LoginDate = DateTime.Now;
                UpdateRow = Obj_FlatType.UpdateFlatType(ref Entity_FlatType, out StrError);
                if (UpdateRow != 0)
                {
                    Obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page);
                    MakeEmptyForm();

                    Entity_FlatType = null;
                    Obj_Comm        = null;
                }
            }

            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
示例#2
0
        public int UpdateFlatType(ref FlatTypeMaster Entity_FlatType, out string StrError)
        {
            int iInsert = 0;

            StrError = string.Empty;
            try
            {
                SqlParameter pAction        = new SqlParameter(FlatTypeMaster._Action, SqlDbType.BigInt);
                SqlParameter pFlatTypeId    = new SqlParameter(FlatTypeMaster._FlatTypeId, SqlDbType.BigInt);
                SqlParameter pFlatType      = new SqlParameter(FlatTypeMaster._FlatType, SqlDbType.NVarChar);
                SqlParameter pProjectTypeID = new SqlParameter(FlatTypeMaster._ProjectTypeID, SqlDbType.BigInt);
                SqlParameter pCreatedBy     = new SqlParameter(FlatTypeMaster._UserId, SqlDbType.BigInt);
                SqlParameter pCreatedDate   = new SqlParameter(FlatTypeMaster._LoginDate, SqlDbType.DateTime);

                pAction.Value        = 2;
                pFlatTypeId.Value    = Entity_FlatType.FlatTypeId;
                pFlatType.Value      = Entity_FlatType.FlatType;
                pProjectTypeID.Value = Entity_FlatType.ProjectTypeID;
                pCreatedBy.Value     = Entity_FlatType.UserId;
                pCreatedDate.Value   = Entity_FlatType.LoginDate;

                SqlParameter[] param = new SqlParameter[] { pAction, pFlatTypeId, pFlatType, pProjectTypeID, pCreatedBy, pCreatedDate };
                Open(CONNECTION_STRING);
                BeginTransaction();
                iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, FlatTypeMaster.SP_FlatTypeMaster, param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                StrError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }
示例#3
0
        public int DeleteFlatType(ref FlatTypeMaster Entity_FlatType, out string StrError)
        {
            int iDelete = 0;

            StrError = string.Empty;

            try
            {
                SqlParameter pAction      = new SqlParameter(FlatTypeMaster._Action, SqlDbType.BigInt);
                SqlParameter pFlatTypeId  = new SqlParameter(FlatTypeMaster._FlatTypeId, SqlDbType.BigInt);
                SqlParameter pDeletedBy   = new SqlParameter(FlatTypeMaster._UserId, SqlDbType.BigInt);
                SqlParameter pDeletedDate = new SqlParameter(FlatTypeMaster._LoginDate, SqlDbType.DateTime);

                pAction.Value      = 3;
                pFlatTypeId.Value  = Entity_FlatType.FlatTypeId;
                pDeletedBy.Value   = Entity_FlatType.UserId;
                pDeletedDate.Value = Entity_FlatType.LoginDate;
                // pIsDeleted.Value = Entity_Country.IsDeleted;

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

                Open(CONNECTION_STRING);
                BeginTransaction();

                iDelete = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, FlatTypeMaster.SP_FlatTypeMaster, param);

                if (iDelete > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                StrError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iDelete);
        }
示例#4
0
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        int i = Convert.ToInt32(hiddenbox.Value);

        if (i == 0)
        {
            try
            {
                int DeleteId = 0;
                if (ViewState["EditID"] != null)
                {
                    if (long.Parse(hdnFldUsedCnt.Value.ToString()) > 0)
                    {
                        Obj_Comm.ShowPopUpMsg("Unit type is in use. Cannot Delete Record...", this.Page);
                        return;
                    }

                    DeleteId = Convert.ToInt32(ViewState["EditID"]);
                }
                if (DeleteId != 0)
                {
                    Entity_FlatType.FlatTypeId = DeleteId;
                    Entity_FlatType.UserId     = Convert.ToInt32(Session["UserId"]);
                    Entity_FlatType.LoginDate  = DateTime.Now;
                    int iDelete = Obj_FlatType.DeleteFlatType(ref Entity_FlatType, out StrError);
                    if (iDelete != 0)
                    {
                        Obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page);
                        MakeEmptyForm();
                    }
                }
                Entity_FlatType = null;
                Obj_Comm        = null;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
示例#5
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0;

        try
        {
            DS = Obj_FlatType.ChkDuplicate(txtFlatType.Text.Trim().ToUpper(), out StrError);
            if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
            {
                Obj_Comm.ShowPopUpMsg("This Unit Type Already Exist For ", this.Page);
                txtFlatType.Focus();
            }
            else
            {
                Entity_FlatType.FlatType = txtFlatType.Text.Trim();


                Entity_FlatType.UserId    = Convert.ToInt32(Session["UserId"]);
                Entity_FlatType.LoginDate = DateTime.Now;

                InsertRow = Obj_FlatType.InsertFlatType(ref Entity_FlatType, out StrError);

                if (InsertRow > 0)
                {
                    Obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page);
                    MakeEmptyForm();

                    Entity_FlatType = null;
                    Obj_Comm        = null;
                }
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }