示例#1
0
        long IALRD_UpazilaInfoDao.Update(ALRD_UpazilaInfoEntity entity, bool isPertial = false)
        {
            long returnCode = -99;

            string SP;

            if (!isPertial)
            {
                SP = "alrd_upazilainfo_Update";
            }
            else
            {
                SP = "alrd_upazilainfo_PertialUpdate";
            }

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                FillParameters(entity, cmd, Database);
                //FillSequrityParameters(securityCapsule, cmd, OparationType.Update, Database);
                AddOutputParameter(cmd);
                try
                {
                    returnCode = Database.ExecuteNonQuery(cmd);
                }
                catch (Exception ex)
                {
                    throw GetDataAccessException(ex, SourceOfException("Update"));
                }
            }
            return(returnCode);
        }
示例#2
0
 public static void FillParameters(ALRD_UpazilaInfoEntity entity, DbCommand cmd, Database Database, bool forDelete = false)
 {
     if (entity.COMPID.HasValue)
     {
         Database.AddInParameter(cmd, "@COMPID", DbType.Int64, entity.COMPID);
     }
     if (forDelete)
     {
         return;
     }
     if (!(string.IsNullOrEmpty(entity.DESCRIPT)))
     {
         Database.AddInParameter(cmd, "@DESCRIPT", DbType.String, entity.DESCRIPT);
     }
     if (entity.DistrictID.HasValue)
     {
         Database.AddInParameter(cmd, "@DistrictID", DbType.Int64, entity.DistrictID);
     }
     if (entity.CreatedBy.HasValue)
     {
         Database.AddInParameter(cmd, "@CreatedBy", DbType.Int64, entity.CreatedBy);
     }
     if (entity.CreatedOn.HasValue)
     {
         Database.AddInParameter(cmd, "@CreatedOn", DbType.DateTime, entity.CreatedOn);
     }
     if (entity.UpdatedBy.HasValue)
     {
         Database.AddInParameter(cmd, "@UpdatedBy", DbType.Int64, entity.UpdatedBy);
     }
     if (entity.UpdatedOn.HasValue)
     {
         Database.AddInParameter(cmd, "@UpdatedOn", DbType.DateTime, entity.UpdatedOn);
     }
 }
示例#3
0
        IList <ALRD_UpazilaInfoEntity> IALRD_UpazilaInfoDao.GetAll(ALRD_UpazilaInfoEntity entity)
        {
            try
            {
                const string SP = "alrd_upazilainfo_GetAll";
                using (DbCommand cmd = Database.GetStoredProcCommand(SP))
                {
                    AddSortExpressionParameter(cmd, entity.SortExpression);
                    FillParameters(entity, cmd, Database);

                    IList <ALRD_UpazilaInfoEntity> itemList = new List <ALRD_UpazilaInfoEntity>();
                    using (IDataReader reader = Database.ExecuteReader(cmd))
                    {
                        while (reader.Read())
                        {
                            itemList.Add(new ALRD_UpazilaInfoEntity(reader));
                        }
                    }
                    return(itemList);
                }
            }
            catch (Exception ex)
            {
                throw GetDataAccessException(ex, SourceOfException("GetAll"));
            }
        }
示例#4
0
        private void DeleteItem(int dataItemIndex)
        {
            ALRD_UpazilaInfoEntity item = LocalDataStore[dataItemIndex];
            long i = SH.Service.ALRD_UpazilaInfoService.GetService().Delete(item);

            SuccessMessage = "Information Deleted Successfully.";
            this.LoadData();
        }
示例#5
0
        private void InsertItem(ListViewItem insertItem)
        {
            ALRD_UpazilaInfoEntity item = new ALRD_UpazilaInfoEntity();

            item.DESCRIPT   = ((TextBox)insertItem.FindControl("txtDESCRIPT")).Text.Trim();
            item.DistrictID = ((DropDownList)insertItem.FindControl("ddlDistrictName")).SelectedIndex > 0 ? long.Parse(((DropDownList)insertItem.FindControl("ddlDistrictName")).SelectedItem.Value) : (long?)null;

            item.CreatedBy = GlobalClass.UserID;
            item.CreatedOn = DateTime.Now;

            long i = SH.Service.ALRD_UpazilaInfoService.GetService().Add(item);

            SuccessMessage = "Information Saved Successfully.";

            this.CloseInsert();
            this.LoadData();
        }
示例#6
0
        private void UpdateItem(ListViewItem insertItem, int dataItemIndex)
        {
            ALRD_UpazilaInfoEntity item = LocalDataStore[dataItemIndex];

            item.DESCRIPT   = ((TextBox)insertItem.FindControl("txtDESCRIPT")).Text.Trim();
            item.DistrictID = ((DropDownList)insertItem.FindControl("ddlDistrictName")).SelectedIndex > 0 ? long.Parse(((DropDownList)insertItem.FindControl("ddlDistrictName")).SelectedItem.Value) : (long?)null;

            item.UpdatedBy = GlobalClass.UserID;
            item.UpdatedOn = DateTime.Now;

            long i = SH.Service.ALRD_UpazilaInfoService.GetService().Update(item);

            SuccessMessage = "Information Updated Successfully.";


            this.lsv_SetupPage.EditIndex = -1;
            this.LoadData();
        }
示例#7
0
        long IALRD_UpazilaInfoDao.Delete(ALRD_UpazilaInfoEntity entity)
        {
            long         returnCode = -99;
            const string SP         = "alrd_upazilainfo_Delete";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                FillParameters(entity, cmd, Database, true);
                //FillSequrityParameters(securityCapsule, cmd, OparationType.Update, Database);
                AddOutputParameter(cmd);
                try
                {
                    returnCode = Database.ExecuteNonQuery(cmd);//Convert.ToInt64(cmd.Parameters["@RETURN_KEY"].Value);
                }
                catch (Exception ex)
                {
                    throw GetDataAccessException(ex, SourceOfException("Delete"));
                }
            }
            return(returnCode);
        }
示例#8
0
        long IALRD_UpazilaInfoDao.Add(ALRD_UpazilaInfoEntity entity)
        {
            long         returnCode = -99;
            const string SP         = "alrd_upazilainfo_Insert";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                FillParameters(entity, cmd, Database);
                //FillSequrityParameters(securityCapsule, cmd, OparationType.Save, Database);
                AddOutputParameter(cmd);
                try
                {
                    returnCode = Database.ExecuteNonQuery(cmd); // GetReturnCodeFromParameter(cmd);
                }
                catch (Exception ex)
                {
                    throw GetDataAccessException(ex, SourceOfException("Add"));
                }
            }
            return(returnCode);
        }