Ejemplo n.º 1
0
        public void CheckAvailabitity(string SearchString, string TableName, string TableColumn)
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            var isValueExists     = false;
            var objCheckAvailable = new CheckAvailable();

            objDbCommand.AddInParameter("SearchString", SearchString);
            objDbCommand.AddInParameter("TableName", TableName);
            objDbCommand.AddInParameter("TableColumn", TableColumn);
            try
            {
                isValueExists =
                    Convert.ToBoolean(objDataAccess.ExecuteScalar(objDbCommand, "ams.uspGetIsAvailable",
                                                                  CommandType.StoredProcedure));
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
            objCheckAvailable.SearchString = SearchString;
            objCheckAvailable.ValueExists  = isValueExists;
            var js = new JavaScriptSerializer();

            Context.Response.Write(js.Serialize(objCheckAvailable));
        }
Ejemplo n.º 2
0
        public void UpdateUserStatus(UserInfo objUserInfo)
        {
            int noOfAffacted = 0;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);

            objDbCommand.AddInParameter("UserId", objUserInfo.UserId);
            objDbCommand.AddInParameter("IsActive", objUserInfo.IsActive);
            objDbCommand.AddInParameter("UpdatedBy", objUserInfo.UpdatedBy);

            try
            {
                noOfAffacted = objDataAccess.ExecuteNonQuery(objDbCommand, "[rdb].[uspUpdateUserStatus]", CommandType.StoredProcedure);
                if (noOfAffacted > 0)
                {
                    objDbCommand.Transaction.Commit();
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 3
0
        public DataTable GetDailyPayStatementReport()
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            var dt = new DataTable();

            try
            {
                objDbCommand.AddInParameter("ConsignmentNumber", ReportObject.ConsignmentNumber);
                objDbCommand.AddInParameter("SupplierId", ReportObject.SupplierId);
                objDbCommand.AddInParameter("FromDate", ReportObject.FromDate);
                objDbCommand.AddInParameter("ToDate", ReportObject.ToDate);
                dt = objDataAccess.ExecuteTable(objDbCommand, "[dbo].uspGetDailyPayStatementReport", CommandType.StoredProcedure);
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }

            return(dt);
        }
Ejemplo n.º 4
0
        public bool GetIsAlreadyRequestedForVisit(VisitRequest objVisitRequest)
        {
            bool IsAlreadyRequested;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            //  objDbCommand.AddInOutParameter("ApplicantId", objApplicant.ApplicantId, ParameterDirection.InputOutput, DbType.Int32, 16);

            objDbCommand.AddInParameter("LandlordId", objVisitRequest.LandlordId);
            objDbCommand.AddInParameter("PropertyId", objVisitRequest.PropertyId);
            objDbCommand.AddInParameter("ApartmentId", objVisitRequest.ApartmentId);

            objDbCommand.AddInParameter("ClientEmail", objVisitRequest.ClientEmail);
            objDbCommand.AddInParameter("ClientMobileNo", objVisitRequest.ClientMobileNo);

            try
            {
                IsAlreadyRequested =
                    (bool)objDataAccess.ExecuteScalar(objDbCommand, "ams.uspIsAlreadyRequestedForVisit", CommandType.StoredProcedure);

            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
            return IsAlreadyRequested;
        }
Ejemplo n.º 5
0
        public string SaveCountry(Country objCountry)
        {
            int noRowCount = 0;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            objDbCommand.AddInParameter("CountryName", objCountry.CountryName);
            objDbCommand.AddInParameter("CreatedBy", SessionUtility.STSessionContainer.UserID);

            try
            {
                noRowCount = objDataAccess.ExecuteNonQuery(objDbCommand, "[dbo].uspCreateCountry", CommandType.StoredProcedure);

                if (noRowCount > 0)
                {
                    objDbCommand.Transaction.Commit();
                    return("Save Successfully");
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                    return("Save Failed");
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 6
0
        public static string GetSingleString(string tableName, string valueColumn, string whereClause)
        {
            string       value;
            IDataAccess  objDataAccess   = DataAccess.NewDataAccess();
            DbCommand    objDbCommand    = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader objDbDataReader = null;

            try
            {
                objDbCommand.AddInParameter("TableName", tableName);
                objDbCommand.AddInParameter("WhereClause", whereClause);
                objDbCommand.AddInParameter("ValueColumn", valueColumn);

                value = (string)objDataAccess.ExecuteScalar(objDbCommand, "uspGetSingleString", CommandType.StoredProcedure);
                if (!string.IsNullOrEmpty(value))
                {
                    return(value);
                }
                else
                {
                    return(null);
                }
            }

            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 7
0
        public string CreateRole(RoleInfo objRole) //updated by enamul
        {
            int noOfAffacted = 0;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            objDbCommand.AddInParameter("RoleName", objRole.RoleName);
            objDbCommand.AddInParameter("CreatedBy", SessionUtility.TBSessionContainer.UserID);

            try
            {
                objDataAccess.ExecuteNonQuery(objDbCommand, "[dbo].[uspCreateRole]", CommandType.StoredProcedure);

                if (noOfAffacted > 0)
                {
                    objDbCommand.Transaction.Commit();
                    return("Save Successful");
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                    return("Save Failed");
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 8
0
        public bool GetAuthenticMenuId(int id, int userId)
        {
            bool IsAuthenticated = false;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader objDbDataReader = null;

            try
            {
                objDbCommand.AddInParameter("MenuId", id);
                objDbCommand.AddInParameter("UserId", userId);
                objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[dbo].uspGetAuthenticatedMenu", CommandType.StoredProcedure);

                if (objDbDataReader.HasRows)
                {
                    IsAuthenticated = true;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }
            return(IsAuthenticated);
        }
Ejemplo n.º 9
0
        public string AssignUserRole(Role objRole)
        {
            int noOfAffacted = 0;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            objDbCommand.AddInParameter("UserId", objRole.UserId);
            objDbCommand.AddInParameter("RoleId", objRole.RoleId);
            objDbCommand.AddInParameter("CreatedByUserId", objRole.CreatedBy);

            try
            {
                noOfAffacted = objDataAccess.ExecuteNonQuery(objDbCommand, "[rdb].[uspCreateUserRoleMapping]", CommandType.StoredProcedure);
                if (noOfAffacted > 0)
                {
                    objDbCommand.Transaction.Commit();
                    return("Save Successful");
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                    return("Save Failed");
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 10
0
        public void ChangeCustomerPasswordByAdmin(Customer objCustomer)
        {
            int noOfAffacted = 0;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);

            objDbCommand.AddInParameter("CustomerUsername", objCustomer.CustomerUsername);
            objDbCommand.AddInParameter("NewPassword", objCustomer.CustomerPassword);
            objDbCommand.AddInParameter("UpdatedByUserId", objCustomer.UpdatedBy);

            try
            {
                noOfAffacted = objDataAccess.ExecuteNonQuery(objDbCommand, "[rdb].[uspUpdateCustomerPasswordByAdmin]",
                                                             CommandType.StoredProcedure);
                if (noOfAffacted > 0)
                {
                    objDbCommand.Transaction.Commit();
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 11
0
        public List <string> SearchProductNameForSaleReturn(string productname, string invoiceNumber) // created by Enamul
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader  objDbDataReader = null;
            List <string> objProductList  = new List <string>();

            objDbCommand.AddInParameter("ProductName", productname);
            objDbCommand.AddInParameter("InvoiceNumber", invoiceNumber);
            objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[rdb].[uspGetProductNameForSaleReturn]", CommandType.StoredProcedure);
            try
            {
                if (objDbDataReader.HasRows)
                {
                    while (objDbDataReader.Read())
                    {
                        objProductList.Add(objDbDataReader["ProductName"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }
            return(objProductList);
        }
Ejemplo n.º 12
0
        public DataTable GetBuyerDetail(ReportModel objReportModel)
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            var dt = new DataTable();

            try
            {
                objDbCommand.AddInParameter("ConsignmentNumber", objReportModel.ConsignmentNumber);
                objDbCommand.AddInParameter("FromDate", objReportModel.FromDate);
                objDbCommand.AddInParameter("ToDate", objReportModel.ToDate);
                objDbCommand.AddInParameter("CustomerId", objReportModel.CustomerId);
                objDbCommand.AddInParameter("CountryId", objReportModel.CountryId);
                dt = objDataAccess.ExecuteTable(objDbCommand, "[dbo].uspGetBuyerDetailReport", CommandType.StoredProcedure);
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }

            return(dt);
        }
Ejemplo n.º 13
0
        private static int SaveSecurities(IDataAccess objDataAccess, DbCommand objDCommand, PropertySecurityType objSecurity, int propertyId)
        {
            objDCommand.Parameters.Clear();
            objDCommand.AddInParameter("SecurityTypeId", objSecurity.SecurityTypeId);
            objDCommand.AddInParameter("PropertyId", propertyId);

            return(objDataAccess.ExecuteNonQuery(objDCommand, "ams.uspInsertPropertyWiseSecurity", CommandType.StoredProcedure));
        }
Ejemplo n.º 14
0
        public List <string> CutomerRecivingAmountAgainestInvoice(string customerId, string collectionSalesId, string receivingAmount) // created by Ataur
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);

            List <string> objInvoiceList = new List <string>();

            objDbCommand.AddInParameter("customerId", customerId);
            objDbCommand.AddInParameter("collectionSalesId", collectionSalesId);
            objDbCommand.AddInParameter("receivingAmount", receivingAmount);



            string userId = "";

            try
            {
                userId = Session["UserId"].ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("Invalid User", ex);
                return(null);
            }

            objDbCommand.AddInParameter("userId", userId);


            try
            {
                int noOfAffacted = objDataAccess.ExecuteNonQuery(objDbCommand, "[rdb].[uspCutomerRecivingAmountAgainestInvoice]", CommandType.StoredProcedure);
                if (noOfAffacted > 0)
                {
                    objDbCommand.Transaction.Commit();
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }

            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }

            return(null);
        }
Ejemplo n.º 15
0
        public int ResetPassword(UserDetail objUser)
        {
            var noOfAffacted = 0;

            //string applicantCode;
            //string spName = "";
            //if (referenceType==EnumBiz.ReferanceType.New.ToString())
            //{
            //    spName = "AHL.prInsertApllicant";
            //}
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            //  objDbCommand.AddInOutParameter("ApplicantId", objApplicant.ApplicantId, ParameterDirection.InputOutput, DbType.Int32, 16);
            objDbCommand.AddInParameter("Email", objUser.Email);
            objDbCommand.AddInParameter("MobileNo", objUser.MobileNo);

            objDbCommand.AddInParameter("Password", objUser.Password);



            try
            {
                //objDataAccess.ExecuteScalar(objDbCommand, "ams.uspResetPassword", CommandType.StoredProcedure);


                if ((int)objDataAccess.ExecuteNonQuery(objDbCommand, "ams.uspResetPassword", CommandType.StoredProcedure) != 0)
                {
                    objDbCommand.Transaction.Commit();
                    return(1); //"Save Successful";
                }


                else
                {
                    objDbCommand.Transaction.Rollback();
                    return(0);//"Registration Failed";
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 16
0
        public CompanyInfo GetCompanyInfoForUpdateCompanyInfo(byte companyId)
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader objDbDataReader = null;
            CompanyInfo  objCompanyInfo  = null;

            try
            {
                objDbCommand.AddInParameter("CompanyId", companyId);
                objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[rdb].[uspGetCompanyInfoForUpdateCompany]", CommandType.StoredProcedure);
                while (objDbDataReader.Read())
                {
                    objCompanyInfo = new CompanyInfo();
                    this.BuildModelForCompanyInfo(objDbDataReader, objCompanyInfo);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }

            return(objCompanyInfo);
        }
Ejemplo n.º 17
0
        protected void Button_Delete_Data_Click(object sender, EventArgs e)
        {
            Button btn        = (Button)(sender);
            var    array      = btn.CommandArgument;
            var    value      = array.Split(",");
            int    Id         = value[0].ToInt32(0);
            string LastEdited = value[1];

            using (DbConnection conn = ConnectionHelper.GetConnection())
            {
                DbCommand cmd = conn.CreateCommand();
                cmd.CommandText = "DELETE FROM GWISAnnotations WHERE id = @id";
                cmd.AddInParameter("@id", DbType.Int32, 4).Value = Id;
                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    CreateMessageAlert("Success", "Delete data success.");
                    setRepeaterAnnot(Request.QueryString["ImageID"]);
                    getEditImage(Request.QueryString["ImageID"]);
                }
                catch (Exception ex)
                {
                    CreateMessageAlert("Error", "Delete data failed. Loc : Button_Delete_Data_Click. Exception : " + ex.Message);
                }
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 填充数据集
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="dataSet"></param>
        /// <param name="sqlParams"></param>
        static void DoFillDataSet(DbCommand cmd, DataSet dataSet, IList <DbParamEntity> sqlParams)
        {
            // DbCommand参数
            if (sqlParams != null && sqlParams.Count > 0)
            {
                foreach (DbParamEntity param in sqlParams)
                {
                    cmd.AddInParameter(param.ParamName, param.ParamType, param.Value);
                }
            }

            // 读取数据
            using (DbDataAdapter adapter = cmd.GetDataAdapter())
            {
                adapter.SelectCommand = cmd;

                try
                {
                    adapter.Fill(dataSet);
                }
                catch (Exception e)
                {
                    throw;
                }
            }
        }
Ejemplo n.º 19
0
        public bool GetSupplierNameIsExist(string supplierName)
        {
            bool SupplierNameIsUse = false;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader objDbDataReader = null;

            try
            {
                objDbCommand.AddInParameter("SupplierName", supplierName);
                objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[dbo].uspGetSupplierNameIsExist", CommandType.StoredProcedure);

                if (objDbDataReader.HasRows)
                {
                    SupplierNameIsUse = true;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }
            return(SupplierNameIsUse);
        }
Ejemplo n.º 20
0
        //delete all measurement
        public string DeleteSupplier(int supplierId)
        {
            int noRowCount = 0;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            objDbCommand.AddInParameter("SupplierId", supplierId);

            try
            {
                noRowCount = objDataAccess.ExecuteNonQuery(objDbCommand, "[dbo].uspDeleteSupplierById", CommandType.StoredProcedure);

                if (noRowCount > 0)
                {
                    objDbCommand.Transaction.Commit();
                    return("Delete Successfully");
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                    return("Delete Failed");
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 21
0
        public List <string> SearchDesignation(string searchText) //created by ataur
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader  objDbDataReader = null;
            List <string> objUserList     = new List <string>();

            objDbCommand.AddInParameter("SearchText", searchText);
            objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[rdb].[uspGetDesignationBySearch]", CommandType.StoredProcedure);
            try
            {
                if (objDbDataReader.HasRows)
                {
                    while (objDbDataReader.Read())
                    {
                        objUserList.Add(objDbDataReader["DesignationName"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }
            return(objUserList);
        }
Ejemplo n.º 22
0
        public List <string> GetDeservedInvoiceNumber(string customerId) // created by Ataur
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader  objDbDataReader = null;
            List <string> objInvoiceList  = new List <string>();

            objDbCommand.AddInParameter("customerId", customerId);
            objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[rdb].[uspCustomerRelatedInvoice]", CommandType.StoredProcedure);
            try
            {
                if (objDbDataReader.HasRows)
                {
                    while (objDbDataReader.Read())
                    {
                        objInvoiceList.Add(objDbDataReader["InvoiceNumber"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }
            return(objInvoiceList);
        }
Ejemplo n.º 23
0
        public DataTable ExecuteDataTable(ref ExecuteParams paras, out bool isHaveOutParams)
        {
            DataTable dtTable = null;
            using (DbConnection cn = DBHelper.OpenConnection(this.ConnectionString))
            {
                using (DbCommand cmd = cn.CreateCommandStoredProc(paras.SPName))
                {
                    var inputParams = paras.SQLParams.FindAll(p => !p.IsOutput);
                    foreach (SQLParam param in inputParams)
                    {
                        DbType dbType = DBHelper.GetDBType(param.DBType);
                        cmd.AddInParameter(param.Name, dbType, param.Value);
                    }

                    var outParams = paras.SQLParams.FindAll(p => p.IsOutput);
                    foreach (SQLParam param in outParams)
                    {
                        DbType dbType = DBHelper.GetDBType(param.DBType);
                        param.DBParam = cmd.AddOutParameter(param.Name, dbType, param.Size);
                    }

                    isHaveOutParams = outParams.Count > 0;
                    dtTable = cmd.ExcuteDataTable();
                }
            }

            return dtTable;
        }
Ejemplo n.º 24
0
        public string CreateFoodScheduleInfo(FoodSchedule objFoodSchedule)
        {
            int noOfAffacted = 0;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            objDbCommand.AddInParameter("FoodScheduleName", objFoodSchedule.FoodScheduleName);
            objDbCommand.AddInParameter("ScheduleDescription", objFoodSchedule.ScheduleDescription);
            objDbCommand.AddInParameter("CreatedByUserId", objFoodSchedule.CreatedBy);
            SqlParameter retval = new SqlParameter("return", SqlDbType.Bit);

            retval.Direction = ParameterDirection.ReturnValue;
            objDbCommand.Parameters.Add(retval);

            try
            {
                objDataAccess.ExecuteNonQuery(objDbCommand, "[rdb].[uspCreateFoodScheduleInfo]",
                                              CommandType.StoredProcedure);

                byte spreturnvalue = Convert.ToByte(retval.Value);

                if (spreturnvalue == 1)
                {
                    objDbCommand.Transaction.Commit();
                    return("Save Successful");
                }
                else if (spreturnvalue == 0)
                {
                    objDbCommand.Transaction.Rollback();
                    return("Already Exists!");
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                    return("Save Failed");
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 25
0
        protected void Button_Edit_Click(object sender, EventArgs e)
        {
            string[] arr1 = TextBox_Start_Edit.Text.Split(",");
            string[] arr2 = TextBox_End_Edit.Text.Split(",");

            int pos_top, pos_left, width, height;

            pos_top  = arr1[1].ToInt32(0);
            pos_left = arr1[0].ToInt32(0);
            height   = arr2[1].ToInt32(0) - pos_top;
            width    = arr2[0].ToInt32(0) - pos_left;

            using (DbConnection conn = ConnectionHelper.GetConnection())
            {
                DbCommand cmd = conn.CreateCommand();
                cmd.CommandText = "UPDATE GWISAnnotations SET color = @color, pos_left = @pos_left, pos_top = @pos_top, width = @width, height = @height, remarks = @remarks, modifieddate = @edit_date, modifiedby = @editor WHERE id = @id";

                cmd.AddInParameter("@pos_top", DbType.Int32, 4).Value   = (pos_top);
                cmd.AddInParameter("@pos_left", DbType.Int32, 4).Value  = (pos_left);
                cmd.AddInParameter("@width", DbType.Int32, 4).Value     = (width);
                cmd.AddInParameter("@height", DbType.Int32, 4).Value    = (height);
                cmd.AddInParameter("@edit_date", DbType.Date).Value     = (DateTime.Today);
                cmd.AddInParameter("@editor", DbType.String, 50).Value  = (HttpContext.Current.User.Identity.Name);
                cmd.AddInParameter("@remarks", DbType.String, 50).Value = (TextBox_Remarks_Edit.Text);
                cmd.AddInParameter("@type", DbType.Int32, 4).Value      = (DropDownList_Type.SelectedValue);
                cmd.AddInParameter("@color", DbType.String, 50).Value   = (DropDownList_Color_Edit.SelectedValue);
                cmd.AddInParameter("@id", DbType.Int32, 4).Value        = (HiddenField_Id_Edit.Value);

                try
                {
                    conn.Open();

                    cmd.ExecuteNonQuery();

                    CreateMessageAlert("Success", "Edit data success.");
                    setRepeaterAnnot(Request.QueryString["ImageID"]);
                    getEditImage(Request.QueryString["ImageID"]);
                    TextBox_Start.Text = "";
                    TextBox_End.Text   = "";
                }
                catch (Exception ex)
                {
                    CreateMessageAlert("Error", "Edit data failed. Loc : Button_Edit_Click. Exception : " + ex.Message);
                }
            }
        }
Ejemplo n.º 26
0
        public SaleDetail GetUnitBagKgPriceByProdcutName(int productId, string consignmentNumber)
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader objDbDataReader = null;
            //List<SaleDetail> objSaleModelList = new List<SaleDetail>();
            SaleDetail objSaleModel = new SaleDetail();

            try
            {
                objDbCommand.AddInParameter("ProductId", productId);
                objDbCommand.AddInParameter("consignmentNumber", consignmentNumber);
                objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "[dbo].uspGetUnitBagKgPriceByProdcutNameForReturnSale",
                                                              CommandType.StoredProcedure);

                if (objDbDataReader.HasRows)
                {
                    while (objDbDataReader.Read())
                    {
                        objSaleModel = new SaleDetail();
                        if (!string.IsNullOrEmpty(objDbDataReader["SaleUnitBag"].ToString()) || !string.IsNullOrEmpty(objDbDataReader["SaleUnitKG"].ToString()))
                        {
                            objSaleModel.SaleUnitBag = Convert.ToDecimal(objDbDataReader["SaleUnitBag"].ToString());
                            objSaleModel.SaleUnitKG  = Convert.ToDecimal(objDbDataReader["SaleUnitKG"].ToString());
                            objSaleModel.SalePrice   = Convert.ToDecimal(objDbDataReader["SalePrice"].ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }

            return(objSaleModel);
        }
Ejemplo n.º 27
0
        public List <ApartmentForAdvartisement> GetApartmentImages(string landloadId, int apartmentId, int propertyId)
        {
            List <ApartmentForAdvartisement> objApartmentForAdvartisementsList = new List <ApartmentForAdvartisement>();

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.ReadCommitted);
            DbDataReader objDbDataReader = null;
            ApartmentForAdvartisement objApartmentForAdvartisement = null;

            objDbCommand.AddInParameter("LandloadId", landloadId);
            objDbCommand.AddInParameter("ApartmentId", apartmentId);
            objDbCommand.AddInParameter("PropertyId ", propertyId);

            try
            {
                objDbDataReader = objDataAccess.ExecuteReader(objDbCommand, "ams.uspGetApartmentImages",
                                                              CommandType.StoredProcedure);
                if (objDbDataReader.HasRows)
                {
                    //DocumentBiz.GetApplicantDocuments(applicantId);
                    while (objDbDataReader.Read())
                    {
                        objApartmentForAdvartisement = new ApartmentForAdvartisement();
                        BuildModel(objDbDataReader, objApartmentForAdvartisement);
                        objApartmentForAdvartisementsList.Add(objApartmentForAdvartisement);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error : " + ex.Message);
            }
            finally
            {
                if (objDbDataReader != null)
                {
                    objDbDataReader.Close();
                }
                objDataAccess.Dispose(objDbCommand);
            }


            return(objApartmentForAdvartisementsList);
        }
Ejemplo n.º 28
0
        public string CreateRegionName(Region objRegion)
        {
            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            objDbCommand.AddInParameter("RegionName", objRegion.RegionName);
            objDbCommand.AddInParameter("RegionDescription", objRegion.RegionDescription);
            objDbCommand.AddInParameter("CreatedBy", objRegion.CreatedBy);

            SqlParameter retValue = new SqlParameter("return", SqlDbType.Bit);
            retValue.Direction = ParameterDirection.ReturnValue;
            objDbCommand.Parameters.Add(retValue);
            try
            {
                objDataAccess.ExecuteNonQuery(objDbCommand, "[rdb].[uspCreateRegionName]", CommandType.StoredProcedure);
                byte spReturnValue = Convert.ToByte(retValue.Value);
                if (spReturnValue == 1)
                {
                    objDbCommand.Transaction.Commit();
                    return "Save Successfull.";
                }
                else if (spReturnValue == 0)
                {
                    objDbCommand.Transaction.Rollback();
                    return "Already Exists!";
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                    return "Save Fail!";
                }

            }
            catch (Exception ex)
            {

                objDbCommand.Transaction.Rollback();
                throw new Exception("Database error", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }
Ejemplo n.º 29
0
        public int SaveApartmentPhotos(List <ApartmentPhotos> objApartmentPhotoList)
        {
            int noOfAffacted = 0;

            try
            {
                foreach (ApartmentPhotos objApartmentPhoto in objApartmentPhotoList)
                {
                    objDataAccess = DataAccess.NewDataAccess();
                    objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);


                    objDbCommand.AddInParameter("PropertyId", objApartmentPhoto.PropertyId);
                    objDbCommand.AddInParameter("ApartmentId", objApartmentPhoto.ApartmentId);
                    objDbCommand.AddInParameter("LandloadId", objApartmentPhoto.LandloadId.Trim());
                    objDbCommand.AddInParameter("PhotoName", objApartmentPhoto.PhotoName);
                    objDbCommand.AddInParameter("PhotoUrl", objApartmentPhoto.PhotoUrl);

                    noOfAffacted = noOfAffacted + objDataAccess.ExecuteNonQuery(objDbCommand, "ams.uspInsertApartmentPhoto", CommandType.StoredProcedure);


                    if (noOfAffacted > 0)
                    {
                        objDbCommand.Transaction.Commit();
                    }
                    else
                    {
                        objDbCommand.Transaction.Rollback();
                        return(noOfAffacted);
                    }
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
            return(noOfAffacted);
        }
Ejemplo n.º 30
0
        public string UpdateChequeDetail(ChequeDetail objChequeDetail)
        {
            int noRowCount = 0;

            objDataAccess = DataAccess.NewDataAccess();
            objDbCommand  = objDataAccess.GetCommand(true, IsolationLevel.Serializable);
            objDbCommand.AddInParameter("ChequeDetailId", objChequeDetail.ChequeDetailId);
            objDbCommand.AddInParameter("ChequeNumber", objChequeDetail.ChequeNumber);
            objDbCommand.AddInParameter("BankDetailId", objChequeDetail.BankName);
            objDbCommand.AddInParameter("ChequeAmount", objChequeDetail.ChequeAmount);
            objDbCommand.AddInParameter("ChequeIssueDate", objChequeDetail.ChequeIssueDateShow);
            objDbCommand.AddInParameter("ChequeSubmitDate", objChequeDetail.ChequeSubmitDateShow);
            objDbCommand.AddInParameter("ChequeMaturedDate", objChequeDetail.ChequeMaturedDateShow);
            objDbCommand.AddInParameter("ChequeStatus", objChequeDetail.ChequeStatusShow);
            objDbCommand.AddInParameter("IsActive", objChequeDetail.IsActive);
            objDbCommand.AddInParameter("UpdatedBy", SessionUtility.STSessionContainer.UserID);

            try
            {
                noRowCount = objDataAccess.ExecuteNonQuery(objDbCommand, "[dbo].uspUpdateChequeDetail", CommandType.StoredProcedure);

                if (noRowCount > 0)
                {
                    objDbCommand.Transaction.Commit();
                    return("Save Successfully");
                }
                else
                {
                    objDbCommand.Transaction.Rollback();
                    return("Save Failed");
                }
            }
            catch (Exception ex)
            {
                objDbCommand.Transaction.Rollback();
                throw new Exception("Database Error Occured", ex);
            }
            finally
            {
                objDataAccess.Dispose(objDbCommand);
            }
        }