private Account_GL_Info GenerateObj(DataRow ordAccount_GL) { if (ordAccount_GL == null) { throw new Exception(""); } Account_GL_Info objAccountGlInfo = new Account_GL_Info(); if (ordAccount_GL["Branch_ID"] != DBNull.Value) { objAccountGlInfo.Branch_ID = Convert.ToString(ordAccount_GL["Branch_ID"]); } if (ordAccount_GL["Account_ID"] != DBNull.Value) { objAccountGlInfo.Account_ID = Convert.ToString(ordAccount_GL["Account_ID"]); } if (ordAccount_GL["Name"] != DBNull.Value) { objAccountGlInfo.Name = Convert.ToString(ordAccount_GL["Name"]); } if (ordAccount_GL["CreditDebit"] != DBNull.Value) { objAccountGlInfo.CreditDebit = (AccountType)Enum.Parse(typeof(AccountType), ordAccount_GL["CreditDebit"].ToString()); } if (ordAccount_GL["Ccy"] != DBNull.Value) { objAccountGlInfo.Ccy = Convert.ToString(ordAccount_GL["Ccy"]); } return(objAccountGlInfo); }
public static int Update(Account_GL_Info obj) { if (Validation(obj)) { return(dal_ac_gl.Update(obj.Account_ID, obj.Name, obj.Branch_ID, obj.CreditDebit, obj.Ccy)); } else { throw new Exception(dal_ac_gl.Error_Message); } }
protected int Delete(Account_GL_Info obj) { if (obj == null) { throw new Exception("Invalid data input"); } _dalAcGL.RemoveOneAccount_GL(obj.Account_ID); if (_dalAcGL.Execute()) { return(_dalAcGL.LastRecordsEffected); } else { throw _dalAcGL.GetException; } }
public SqlCommand EditOneAccount_GL(Account_GL_Info objAccountGlInfo) { SqlCommand command = new SqlCommand(@"UPDATE [Account_GL] SET [Name] = @Name ,[Branch_ID] = @Branch_ID ,[CreditDebit] = @CreditDebit ,[Ccy] = @Ccy WHERE [Account_ID] = @Account_ID"); command.CommandType = CommandType.Text; command.Parameters.Add("@Account_ID", SqlDbType.NVarChar, 25).Value = objAccountGlInfo.Account_ID; command.Parameters.Add("@Name", SqlDbType.NVarChar, 135).Value = objAccountGlInfo.Name; command.Parameters.Add("@Branch_ID", SqlDbType.NVarChar, 50).Value = objAccountGlInfo.Branch_ID; command.Parameters.Add("@CreditDebit", SqlDbType.NVarChar, 50).Value = objAccountGlInfo.CreditDebit; command.Parameters.Add("@Ccy", SqlDbType.NVarChar, 50).Value = objAccountGlInfo.Ccy; this.AddCommand(command); return(command); }
/// <summary> /// lấy mã tài khoản GL gắn với mã dịch vụ /// </summary> /// <param name="catid">mã sản phẩm</param> /// <returns></returns> private Categories_Info GenerateObj(DataRow ordCategories) { if (ordCategories == null) { throw new Exception("Data row is empty or null"); } Categories_Info objCategoriesInfo = new Categories_Info(); if (ordCategories["CatID"] != DBNull.Value) { objCategoriesInfo.ID = Convert.ToString(ordCategories["CatID"]); } if (ordCategories["CatName"] != DBNull.Value) { objCategoriesInfo.Name = Convert.ToString(ordCategories["CatName"]); } Account_GL_Info objAccountGlInfo = new Account_GL_Info(); if (ordCategories["Branch_ID"] != DBNull.Value) { objAccountGlInfo.Branch_ID = Convert.ToString(ordCategories["Branch_ID"]); } if (ordCategories["Account_ID"] != DBNull.Value) { objAccountGlInfo.Account_ID = Convert.ToString(ordCategories["Account_ID"]); } if (ordCategories["Name"] != DBNull.Value) { objAccountGlInfo.Name = Convert.ToString(ordCategories["Name"]); } if (ordCategories["CreditDebit"] != DBNull.Value) { objAccountGlInfo.CreditDebit = (AccountType)Enum.Parse(typeof(AccountType), ordCategories["CreditDebit"].ToString()); } if (ordCategories["Ccy"] != DBNull.Value) { objAccountGlInfo.Ccy = Convert.ToString(ordCategories["Ccy"]); } objCategoriesInfo.Account_GL = objAccountGlInfo; return(objCategoriesInfo); }
public int Update(string accountId, string name, string branch, AccountType creditdebit, string currency) { if (string.IsNullOrEmpty(accountId)) { SetError(98, "Invalid account Id"); return(Error_Number); } if (string.IsNullOrEmpty(name)) { SetError(98, "Invalid account name"); return(Error_Number); } if (string.IsNullOrEmpty(creditdebit.ToString())) { SetError(98, "Invalid account credit/debit"); return(Error_Number); } if (string.IsNullOrEmpty(currency)) { SetError(98, "Invalid currency"); return(Error_Number); } Account_GL_Info acGLInfo = base.GetAccountGLByID(accountId); if (acGLInfo == null) { SetError(99, "Account GL not find"); return(Error_Number); } acGLInfo.Name = name; acGLInfo.Branch_ID = branch; acGLInfo.Ccy = currency; acGLInfo.CreditDebit = creditdebit; if (base.Update(acGLInfo) != 0) { SetError(0, String.Empty); } else { SetError(99, _dalAcGL.GetException.Message); } return(Error_Number); }
public int Update(string id, string name, string account_GL) { if (string.IsNullOrEmpty(id)) { SetError(98, "Categories Id is null or empty"); return(Error_Number); } if (string.IsNullOrEmpty(name)) { SetError(98, "Categories name is null or empty"); return(Error_Number); } AccountGL dal_AcGL = new AccountGL(); Account_GL_Info acGLInfo = dal_AcGL.GetAccountGLByID(account_GL); if (acGLInfo == null) { SetError(98, "Account_GL not find"); return(Error_Number); } Categories_Info catInfo = base.GetCategoriesById(id); if (catInfo == null) { SetError(99, "Categories not find"); return(Error_Number); } // Set info catInfo.Name = name; catInfo.Account_GL = acGLInfo; if (base.Update(catInfo) != 0) { SetError(0, string.Empty); } else { SetError(99, _dalCat.GetException.Message); } return(Error_Number); }
public int Insert(string accountId, string name, string branch, AccountType creditdebit, string currency) { if (string.IsNullOrEmpty(accountId)) { SetError(98, "Invalid account Id"); return(Error_Number); } if (string.IsNullOrEmpty(name)) { SetError(98, "Invalid account name"); return(Error_Number); } if (string.IsNullOrEmpty(creditdebit.ToString())) { SetError(98, "Invalid account credit/debit"); return(Error_Number); } if (string.IsNullOrEmpty(currency)) { SetError(98, "Invalid currency"); return(Error_Number); } Account_GL_Info acGLInfo = new Account_GL_Info(); acGLInfo.Account_ID = accountId; acGLInfo.Name = name; acGLInfo.Branch_ID = branch; acGLInfo.Ccy = currency; acGLInfo.CreditDebit = creditdebit; if (base.Insert(acGLInfo) != 0) { SetError(0, String.Empty); } else { SetError(99, _dalAcGL.GetException.Message); } return(Error_Number); }
private static bool Validation(Account_GL_Info obj) { bstr = new StringBuilder(); if (obj == null) { bstr.Append("Invalid object\n"); } if (string.IsNullOrEmpty(obj.Account_ID)) { bstr.Append("Account_ID is null or empty\n"); } if (string.IsNullOrEmpty(obj.Name)) { bstr.Append("Name is null or empty\n"); } if (string.IsNullOrEmpty(bstr.ToString())) { return(true); } else { return(false); } }
public SqlCommand CreateOneAccount_GL(Account_GL_Info objAccountGlInfo) { SqlCommand command = new SqlCommand(@"INSERT INTO [Account_GL] ([Account_ID] ,[Name] ,[Branch_ID] ,[CreditDebit] ,[Ccy]) VALUES (@Account_ID ,@Name ,@Branch_ID ,@CreditDebit ,@Ccy)"); command.CommandType = CommandType.Text; command.Parameters.Add("@Account_ID", SqlDbType.NVarChar, 25).Value = objAccountGlInfo.Account_ID; command.Parameters.Add("@Name", SqlDbType.NVarChar, 135).Value = objAccountGlInfo.Name; command.Parameters.Add("@Branch_ID", SqlDbType.NVarChar, 50).Value = objAccountGlInfo.Branch_ID; command.Parameters.Add("@CreditDebit", SqlDbType.NVarChar, 50).Value = objAccountGlInfo.CreditDebit; command.Parameters.Add("@Ccy", SqlDbType.NVarChar, 50).Value = objAccountGlInfo.Ccy; this.AddCommand(command); return(command); }
public int Delete(string accountId) { if (string.IsNullOrEmpty(accountId)) { SetError(98, "Invalid account Id"); return(Error_Number); } Account_GL_Info acGLInfo = base.GetAccountGLByID(accountId); if (acGLInfo == null) { SetError(99, "Account GL not find"); return(Error_Number); } if (base.Delete(acGLInfo) != 0) { SetError(0, String.Empty); } else { SetError(99, _dalAcGL.GetException.Message); } return(Error_Number); }