protected void BtnSave_Click(object sender, EventArgs e) { //Session["CompanyId"] = "24"; try { Session["AccFrom"] = "S"; accountantCls.GetLevelChartIDLevel5(); Session["Cut"] = _CustomerNameText.Text; accountantCls.Cmd.Connection.ConnectionString = accountantCls.GetConnStr(); accountantCls.Cmd.CommandType = CommandType.StoredProcedure; accountantCls.Cmd.Parameters.Clear(); accountantCls.Cmd.CommandText = "USP_Customer_Save_Supplier"; accountantCls.Cmd.Parameters.Add("CustomerId", SqlDbType.Int).Value = 0; accountantCls.Cmd.Parameters.Add("CustomerName", SqlDbType.NVarChar).Value = Session["Cut"].ToString(); accountantCls.Cmd.Parameters.Add("CUSTypeOfBusiness", SqlDbType.Int).Value = 0; accountantCls.Cmd.Parameters.Add("CountryId", SqlDbType.Int).Value = 966; accountantCls.Cmd.Parameters.Add("CityId", SqlDbType.Int).Value = 0; accountantCls.Cmd.Parameters.Add("CUSIDType", SqlDbType.Int).Value = 0; accountantCls.Cmd.Parameters.Add("CUSIdNumber", SqlDbType.NVarChar).Value = 0; accountantCls.Cmd.Parameters.Add("CUSEmail", SqlDbType.NVarChar).Value = _EmailText.Text; accountantCls.Cmd.Parameters.Add("CUSContactNo", SqlDbType.NVarChar).Value = _MobileText.Text; accountantCls.Cmd.Parameters.Add("CUSFaxNo", SqlDbType.NVarChar).Value = "-"; accountantCls.Cmd.Parameters.Add("CUSAddress", SqlDbType.NVarChar).Value = "-"; accountantCls.Cmd.Parameters.Add("Password", SqlDbType.NVarChar).Value = Midwest.Security.RijndaelEncryptionAlg.RijndaelEncryption.Encrypt(_PasswordText.Text); accountantCls.Cmd.Parameters.Add("CompanyId", SqlDbType.Int).Value = Session["CompanyId"].ToString(); accountantCls.Cmd.Parameters.Add("COAChartCode", SqlDbType.NVarChar).Value = Session["COAChartCode"].ToString(); accountantCls.Cmd.Parameters.Add("@CreatedBy", SqlDbType.Int).Value = 0; accountantCls.Cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = DateTime.Now; //accountantCls.Cmd.Parameters.Add("CustomerId", SqlDbType.Int).Value = 0; //accountantCls.Cmd.Parameters.Add("CustomerName", SqlDbType.NVarChar).Value = _CustomerNameText.Text; //accountantCls.Cmd.Parameters.Add("CUSTypeOfBusiness", SqlDbType.Int).Value = 0; //accountantCls.Cmd.Parameters.Add("CountryId", SqlDbType.Int).Value = 966; //accountantCls.Cmd.Parameters.Add("CityId", SqlDbType.Int).Value = 0; //accountantCls.Cmd.Parameters.Add("CUSIDType", SqlDbType.Int).Value = 0; //accountantCls.Cmd.Parameters.Add("CUSIdNumber", SqlDbType.NVarChar).Value = 0; //accountantCls.Cmd.Parameters.Add("CUSEmail", SqlDbType.NVarChar).Value = _EmailText.Text; //accountantCls.Cmd.Parameters.Add("CUSContactNo", SqlDbType.NVarChar).Value = _MobileText.Text; //accountantCls.Cmd.Parameters.Add("CUSFaxNo", SqlDbType.NVarChar).Value = "-"; //accountantCls.Cmd.Parameters.Add("CUSAddress", SqlDbType.NVarChar).Value = "-"; //accountantCls.Cmd.Parameters.Add("Password", SqlDbType.NVarChar).Value = Midwest.Security.RijndaelEncryptionAlg.RijndaelEncryption.Encrypt(_PasswordText.Text); //accountantCls.Cmd.Parameters.Add("CompanyId", SqlDbType.Int).Value = Session["CompanyId"].ToString(); //accountantCls.Cmd.Parameters.Add("LedgerId", SqlDbType.Int).Value = 0; //accountantCls.Cmd.Parameters.Add("@CreatedBy", SqlDbType.Int).Value = Session["UserCode"].ToString(); //accountantCls.Cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = DateTime.Now; class1.ErrorNo = 0; accountantCls.beginTrans(); class1.RecordId = Convert.ToInt32(accountantCls.Cmd.ExecuteScalar()); if (class1.RecordId == 0) { class1.ErrorNo = -1; class1.ErrorDesc = Resources.ResourceMain.CompanyAlreadyExists; } else if (class1.RecordId == -1) { class1.ErrorNo = -1; class1.ErrorDesc = Resources.ResourceMain.UserAlreadyExists; } else { Session["EditId"] = class1.RecordId; LabelErrorMessage.Text = "Successfully registered, you can add more information about your self or login to system"; BtnClear.Visible = true; BtnSave.Visible = false; } accountantCls.commitTrans(); } catch (Exception ex) { accountantCls.rollBackTrans(); class1.ErrorDesc = ex.Message; class1.ErrorNo = -1; } finally { SqlDataSource1.DataBind(); } }
protected void BtnSave_Click(object sender, EventArgs e) { try { if (RadioButtonListAccountType.SelectedValue == "0") { Session["AccFrom"] = "B"; } else { Session["AccFrom"] = "CA"; } accountantCls.GetLevelChartIDLevel5(); _LedgerIdText.Text = Session["COAChartCode"].ToString(); Session["Cut"] = _BNKBankNameArabicText.Text + " : " + _BNKBankNameEnglishText.Text; accountantCls.Cmd.Connection.ConnectionString = accountantCls.GetConnStr(); accountantCls.Cmd.CommandType = CommandType.StoredProcedure; accountantCls.Cmd.Parameters.Clear(); accountantCls.Cmd.CommandText = "USP_Bank_Save"; accountantCls.Cmd.Parameters.Add("@BankId", SqlDbType.Int).Value = 0; accountantCls.Cmd.Parameters.Add("@CompanyId", SqlDbType.Int).Value = Session["CompanyId"].ToString(); accountantCls.Cmd.Parameters.Add("@BNKBankNameArabic", SqlDbType.NVarChar).Value = _BNKBankNameArabicText.Text; accountantCls.Cmd.Parameters.Add("@BNKBankNameEnglish", SqlDbType.NVarChar).Value = _BNKBankNameEnglishText.Text; accountantCls.Cmd.Parameters.Add("@LedgerId", SqlDbType.NVarChar).Value = Session["COAChartCode"].ToString(); accountantCls.Cmd.Parameters.Add("@AccountType", SqlDbType.NVarChar).Value = RadioButtonListAccountType.SelectedValue; accountantCls.Cmd.Parameters.Add("@UserId", SqlDbType.Int).Value = Session["UserCode"].ToString(); class1.ErrorNo = 0; accountantCls.beginTrans(); //accountantCls.Cmd.ExecuteNonQuery(); class1.RecordId = Convert.ToInt32(accountantCls.Cmd.ExecuteScalar()); ////update applications status - finance accountantCls.Cmd.Parameters.Clear(); if (class1.RecordId == 0) { class1.ErrorNo = -1; class1.ErrorDesc = Resources.ResourceMain.CompanyAlreadyExists; } else if (class1.RecordId == -1) { class1.ErrorNo = -1; class1.ErrorDesc = Resources.ResourceMain.UserAlreadyExists; } accountantCls.commitTrans(); } catch (Exception ex) { accountantCls.rollBackTrans(); class1.ErrorDesc = ex.Message; class1.ErrorNo = -1; } finally { SqlDataSource1.DataBind(); GvCompany.DataBind(); } }