Пример #1
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        int UpdateRow = 0;

        try
        {
            if (ViewState["EditID"] != null)
            {
                Entity_SL.TowerID = Convert.ToInt32(ViewState["EditID"]);
            }
            Entity_SL.TowerName = TxtTower.Text.Trim();

            Entity_SL.UserId    = Convert.ToInt32(Session["UserId"]);
            Entity_SL.LoginDate = DateTime.Now;
            UpdateRow           = Obj_SL.UpdateRecord(ref Entity_SL, out StrError);

            if (UpdateRow != 0)
            {
                obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page);
                MakeEmptyForm();
                Entity_SL = null;
                obj_Comm  = null;
            }
        }

        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Пример #2
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_SL.TowerID   = DeleteId;
             Entity_SL.UserId    = Convert.ToInt32(Session["UserID"]);
             Entity_SL.LoginDate = DateTime.Now;
             Entity_SL.IsDeleted = true;
             int iDelete = Obj_SL.DeleteRecord(ref Entity_SL, out StrError);
             if (iDelete != 0)
             {
                 obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page);
                 MakeEmptyForm();
             }
         }
         Entity_SL = null;
         obj_Comm  = null;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #3
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0;

        try
        {
            DS = Obj_SL.ChkDuplicate(TxtTower.Text.Trim(), out StrError);

            if (DS.Tables[0].Rows.Count > 0)
            {
                obj_Comm.ShowPopUpMsg("Tower Name Already Exist..!", this.Page);
                TxtTower.Focus();
            }
            else
            {
                Entity_SL.TowerName = TxtTower.Text.Trim();
                Entity_SL.UserId    = Convert.ToInt32(Session["UserId"]);
                Entity_SL.LoginDate = DateTime.Now;
                Entity_SL.IsDeleted = false;
                InsertRow           = Obj_SL.InsertRecord(ref Entity_SL, out StrError);

                if (InsertRow != 0)
                {
                    obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page);
                    MakeEmptyForm();
                    Entity_SL = null;
                    obj_Comm  = null;
                }
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Пример #4
0
        public int InsertRecord(ref TowerMaster Entity_call, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction    = new SqlParameter(TowerMaster._Action, SqlDbType.BigInt);
                SqlParameter pTowerName = new SqlParameter(TowerMaster._TowerName, SqlDbType.NVarChar);

                SqlParameter pCreatedBy   = new SqlParameter(TowerMaster._UserId, SqlDbType.BigInt);
                SqlParameter PCreatedDate = new SqlParameter(TowerMaster._LoginDate, SqlDbType.DateTime);
                SqlParameter pIsDeleted   = new SqlParameter(TowerMaster._IsDeleted, SqlDbType.Bit);

                pAction.Value    = 1;
                pTowerName.Value = Entity_call.TowerName;

                pCreatedBy.Value   = Entity_call.UserId;
                PCreatedDate.Value = Entity_call.LoginDate;
                pIsDeleted.Value   = Entity_call.IsDeleted;

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

                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, TowerMaster.SP_TowerMaster, param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }
Пример #5
0
 public void Initialize(TowerMaster parent)
 {
     this.parent = parent;
     this.target = parent.target;
     this.damage = parent.getDamage();
 }