public static CSQLResult BranchDetailSave(BranchModel branchModel, int ModifiedBy, int ModifiedSourceCode) { CSQLResult oResult = new CSQLResult(); try { CShared oDBShared = new CShared(); string ePassword = CShared.GetEncryptString(branchModel.Password); string spParameter = branchModel.BranchID + ", " + branchModel.CompanyID + ",'" + branchModel.Name + "','" + branchModel.Address + "','" + branchModel.Email + "','" + branchModel.Location + "','" + branchModel.Mobile + "','" + branchModel.Username + "','" + ePassword + "'," + ModifiedBy + "," + ModifiedBy + "," + ModifiedSourceCode; DataSet dsBranch = oDBShared.GetDataSet("TBranch", "uspBranchDetailSave " + spParameter); using (DataTable dtBranch = dsBranch.Tables["TBranch"]) { if (dtBranch != null && dtBranch.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtBranch.Rows[0]["IsSuccess"]); oResult.Exception = dtBranch.Rows[0]["ErrorSuccessMsg"].ToString(); if (oResult.Success) { // SET OTHER PARAMETER INFORMATION //oResult.OtherParameter = dtCompany.Rows[0]["OrgPrjID"].ToString(); } } } } catch (Exception ex) { //oResult.Success = false; //oResult.WasSuccessful = 0; //oResult.Exception = ex.Message; throw ex; } return(oResult); }
public static CSQLResult CompanyDetailSave(CompanyModel companyModel, int ModifiedBy) { CSQLResult oResult = new CSQLResult(); try { CShared oDBShared = new CShared(); string ePassword = CShared.GetEncryptString(companyModel.MasterPassword); string spParameter = companyModel.CompanyID + ", '" + companyModel.Name + "','" + companyModel.Address + "','" + companyModel.Email + "','" + companyModel.Mobile + "','" + companyModel.LogoImgPath + "','" + companyModel.MasterUsername + "','" + ePassword + "'," + ModifiedBy + "," + ModifiedBy; DataSet dsCompany = oDBShared.GetDataSet("TCompany", "uspCompanySave " + spParameter); using (DataTable dtCompany = dsCompany.Tables["TCompany"]) { if (dtCompany != null && dtCompany.Rows.Count > 0) { oResult.Success = Convert.ToBoolean(dtCompany.Rows[0]["IsSuccess"]); oResult.Exception = dtCompany.Rows[0]["ErrorSuccessMsg"].ToString(); if (oResult.Success) { // SET OTHER PARAMETER INFORMATION //oResult.OtherParameter = dtCompany.Rows[0]["OrgPrjID"].ToString(); } } } } catch (Exception ex) { //oResult.Success = false; //oResult.WasSuccessful = 0; //oResult.Exception = ex.Message; throw ex; } return(oResult); }
public static CGeneralUser Login(string UserName, string PassWord) { CGeneralUser oResult = new CGeneralUser(); try { CShared oDBShared = new CShared(); string ePassword = CShared.GetEncryptString(PassWord); DataSet dsLogin = oDBShared.GetDataSet("TLogin", "uspLogin '" + UserName + "', '" + ePassword + "'"); using (DataTable dtLogin = dsLogin.Tables["TLogin"]) { if (dtLogin != null && dtLogin.Rows.Count > 0) { if (Convert.ToBoolean(dtLogin.Rows[0]["Success"])) { // TRUE FOR ORGANIZATION oResult.DisplayName = dtLogin.Rows[0]["DisplayName"].ToString(); oResult.UserID = Convert.ToInt32(dtLogin.Rows[0]["UserID"]); oResult.LoginTypeCode = Convert.ToInt32(dtLogin.Rows[0]["LoginTypeCode"]); oResult.LastLogged = Convert.ToDateTime(dtLogin.Rows[0]["LastLogged"]).ToString("MM/dd/yyyy h:mm tt"); oResult.Success = Convert.ToBoolean(dtLogin.Rows[0]["Success"]); oResult.WasSuccessful = Convert.ToInt32(dtLogin.Rows[0]["Success"]); oResult.Exception = dtLogin.Rows[0]["ErrorSuccessMsg"].ToString(); } // FAILED TO LOGIN else { oResult.Success = Convert.ToBoolean(dtLogin.Rows[0]["Success"]); oResult.WasSuccessful = Convert.ToInt32(dtLogin.Rows[0]["Success"]); oResult.Exception = dtLogin.Rows[0]["ErrorSuccessMsg"].ToString(); } } } } catch (Exception ex) { //oResult.Success = false; //oResult.WasSuccessful = 0; //oResult.Exception = ex.Message; throw ex; } return(oResult); }