public static bool SavePropertyDetails(ATTPropertyDetails objPD) { try { return(DLLPropertyDetails.SavePropertyDetails(objPD)); } catch (Exception ex) { throw ex; } }
public static bool SavePropertyDetails(ATTPropertyDetails objPDetails) { GetConnection Conn = new GetConnection(); //OracleConnection DBConn = Conn.GetDbConn("PMS_ADMIN", "PMS_ADMIN"); OracleConnection DBConn = Conn.GetDbConn(Module.PMS); OracleTransaction Tran = DBConn.BeginTransaction(); try { string SaveSQL = "SP_ADD_PROPERTYDETAILS"; foreach (ATTPropertyDetails objPD in objPDetails.LstPropertyDetails) { OracleParameter[] paramArray = new OracleParameter[6]; paramArray[0] = Utilities.GetOraParam(":P_EMP_ID", objPD.EmpID, OracleDbType.Int64, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam(":p_SUB_DATE", objPD.SubDate, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":P_PCAT_ID", objPD.PCatID, OracleDbType.Int64, ParameterDirection.Input); paramArray[3] = Utilities.GetOraParam(":P_COL_NO", objPD.ColNo, OracleDbType.Int64, ParameterDirection.Input); paramArray[4] = Utilities.GetOraParam(":P_ROW_NO", objPD.RowNo, OracleDbType.Int64, ParameterDirection.Input); paramArray[5] = Utilities.GetOraParam(":P_VALUE", objPD.Value, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, SaveSQL, paramArray); } if (objPDetails.LstPropertyIncome.Count > 0) { DLLPropertyIncome.SavePropertyIncome(objPDetails.LstPropertyIncome, Tran); } Tran.Commit(); return(true); } catch (Exception ex) { Tran.Rollback(); throw(ex); } }
public void SavePropertyDetails() { try { //------------------------------------------------------------ //NB: For Property Category Save //------------------------------------------------------------ if (Session["grdPCat"] != null) { int rowIndex = 0; DataTable dtCurrentTable = (DataTable)Session["grdPCat"]; ArrayList myList = new ArrayList(); ArrayList myListType = new ArrayList(); myList = (ArrayList)Session["myList"]; myListType = (ArrayList)Session["myListType"]; List <ATTPropertyDetails> lstPropertyDetail = new List <ATTPropertyDetails>(); List <ATTPropertyIncome> lstPropertyIncome = new List <ATTPropertyIncome>(); if (dtCurrentTable.Rows.Count > 0) { for (int i = 1; i <= dtCurrentTable.Rows.Count; i++) { int count = int.Parse(myList.Count.ToString()); ArrayList myTextBoxList = new ArrayList(); for (int j = 1; j < count; j++) { string TextBoxID = "TextBox" + Convert.ToString(j); TextBox box = new TextBox(); box = (TextBox)grdPropertyDetails.Rows[rowIndex].Cells[j].FindControl(TextBoxID); myTextBoxList.Add(box.Text); } for (int k = 1; k < count; k++) { ATTPropertyDetails objPD = new ATTPropertyDetails(); objPD.EmpID = int.Parse(Session["PrpEmpID"].ToString()); objPD.PCatID = int.Parse(lstProperty.SelectedValue.ToString()); objPD.ColNo = k + 1; objPD.RowNo = rowIndex + 1; objPD.Value = myTextBoxList[k - 1].ToString(); objPD.SubDate = Session["SubDate"].ToString(); lstPropertyDetail.Add(objPD); } rowIndex++; } //------------------------------------------------------------ //NB: For Amount Date Save //------------------------------------------------------------ if (Session["AmountDate"] != null) { if (grdAmountDate.Rows.Count > 0) { foreach (GridViewRow gvr in grdAmountDate.Rows) { TextBox box1 = new TextBox(); box1 = (TextBox)gvr.Cells[1].FindControl("txtAmount_ad"); //int val = int.Parse(box1.Text); TextBox box2 = new TextBox(); box2 = (TextBox)gvr.Cells[2].FindControl("txtDate_DT"); //string date = box2.Text; ATTPropertyIncome objPInc = new ATTPropertyIncome(); objPInc.EmpID = int.Parse(Session["PrpEmpID"].ToString()); objPInc.PCatID = int.Parse(lstProperty.SelectedValue.ToString()); objPInc.SubDate = Session["SubDate"].ToString(); objPInc.Amount = Convert.ToDouble(box1.Text); objPInc.Year = box2.Text; lstPropertyIncome.Add(objPInc); } } } ATTPropertyDetails objPDToSave = new ATTPropertyDetails(); objPDToSave.LstPropertyDetails = lstPropertyDetail; objPDToSave.LstPropertyIncome = lstPropertyIncome; if (BLLPropertyDetails.SavePropertyDetails(objPDToSave)) { ArrayList alreadySet = new ArrayList(); if (Session["alreadySet"] != null) { alreadySet = (ArrayList)Session["alreadySet"]; } alreadySet.Add(lstProperty.SelectedValue); Session["alreadySet"] = (object)alreadySet; Session["AmountDate"] = null; btnSave.Visible = false; this.lblStatusMessageTitle.Text = "Save Status"; if (this.lblStatusMessageTitle.Text != "") { this.lblStatusMessage.Text = " Details for '" + lstProperty.SelectedItem + "' is saved successfully !!!"; this.programmaticModalPopup.Show(); } } } } } catch (Exception ex) { this.lblStatusMessageTitle.Text = "Error Status"; this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }