public void SaveCallLoginDetail(CallLoginDetail argCallLoginDetail, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsCallLoginDetailExists(argCallLoginDetail.CallCode, argCallLoginDetail.ItemNo, argCallLoginDetail.ClientCode, da) == false)
         {
             InsertCallLoginDetail(argCallLoginDetail, da, lstErr);
         }
         else
         {
             UpdateCallLoginDetail(argCallLoginDetail, da, lstErr);
         }
     }
     catch (Exception ex)
     {
         objErrorHandler.Type       = ErrorConstant.strAboartType;
         objErrorHandler.MsgId      = 0;
         objErrorHandler.Module     = ErrorConstant.strInsertModule;
         objErrorHandler.ModulePart = ErrorConstant.strDetailModule;
         objErrorHandler.Message    = ex.Message.ToString();
         objErrorHandler.RowNo      = 0;
         objErrorHandler.FieldName  = "";
         objErrorHandler.LogCode    = "";
         lstErr.Add(objErrorHandler);
     }
 }
        private CallLoginDetail objCreateCallLoginDetail(DataRow dr)
        {
            CallLoginDetail tCallLoginDetail = new CallLoginDetail();

            tCallLoginDetail.SetObjectInfo(dr);

            return(tCallLoginDetail);
        }
        public void colGetCallLoginDetail(string argCallCode, int argItemNo, string argClientCode, ref CallLoginDetailCol argCallLoginDetailCol)
        {
            DataSet         DataSetToFill    = new DataSet();
            CallLoginDetail tCallLoginDetail = new CallLoginDetail();

            DataSetToFill = this.GetCallLoginDetail(argCallCode, argItemNo, argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    argCallLoginDetailCol.colCallLoginDetail.Add(objCreateCallLoginDetail(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;
        }
        public CallLoginDetail objGetCallLoginDetail(string argCallCode, int argItemNo, string argClientCode)
        {
            CallLoginDetail argCallLoginDetail = new CallLoginDetail();
            DataSet         DataSetToFill      = new DataSet();

            if (argCallCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argItemNo <= 0)
            {
                goto ErrorHandlers;
            }

            if (argClientCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            DataSetToFill = this.GetCallLoginDetail(argCallCode, argItemNo, argClientCode);

            if (DataSetToFill.Tables[0].Rows.Count <= 0)
            {
                goto Finish;
            }

            argCallLoginDetail = this.objCreateCallLoginDetail((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argCallLoginDetail);
        }
        public ICollection <CallLoginDetail> colGetCallLoginDetail(string argCallCode, string argClientCode, List <CallLoginDetail> lst)
        {
            //List<SalesOrderDetail> lst = new List<SalesOrderDetail>();
            DataSet         DataSetToFill    = new DataSet();
            CallLoginDetail tCallLoginDetail = new CallLoginDetail();

            DataSetToFill = this.GetCallLoginDetail(argCallCode, argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    lst.Add(objCreateCallLoginDetail(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public void UpdateCallLoginDetail(CallLoginDetail argCallLoginDetail, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[65];
            param[0]  = new SqlParameter("@CallCode", argCallLoginDetail.CallCode);
            param[1]  = new SqlParameter("@ItemNo", argCallLoginDetail.ItemNo);
            param[2]  = new SqlParameter("@SerialNo", argCallLoginDetail.SerialNo);
            param[3]  = new SqlParameter("@MaterialCode", argCallLoginDetail.MaterialCode);
            param[4]  = new SqlParameter("@MaterialTypeCode", argCallLoginDetail.MaterialTypeCode);
            param[5]  = new SqlParameter("@MatGroup1Code", argCallLoginDetail.MatGroup1Code);
            param[6]  = new SqlParameter("@WarrantyOn", argCallLoginDetail.WarrantyOn);
            param[7]  = new SqlParameter("@WarrantyEndDate", argCallLoginDetail.WarrantyEndDate);
            param[8]  = new SqlParameter("@ConditionCode", argCallLoginDetail.ConditionCode);
            param[9]  = new SqlParameter("@CustComplaint", argCallLoginDetail.CustComplaint);
            param[10] = new SqlParameter("@WarrantyStatus", argCallLoginDetail.WarrantyStatus);
            param[11] = new SqlParameter("@OutWarReason", argCallLoginDetail.OutWarReason);
            param[12] = new SqlParameter("@CallTypeCode", argCallLoginDetail.CallTypeCode);
            param[13] = new SqlParameter("@CallFrom", argCallLoginDetail.CallFrom);
            param[14] = new SqlParameter("@CustInvoiceDate", argCallLoginDetail.CustInvoiceDate);
            param[15] = new SqlParameter("@CustInvoiceNo", argCallLoginDetail.CustInvoiceNo);
            param[16] = new SqlParameter("@CustName", argCallLoginDetail.CustName);
            param[17] = new SqlParameter("@CustAddress1", argCallLoginDetail.CustAddress1);
            param[18] = new SqlParameter("@CustAddress2", argCallLoginDetail.CustAddress2);
            param[19] = new SqlParameter("@CustPhone", argCallLoginDetail.CustPhone);
            param[20] = new SqlParameter("@CustMobile", argCallLoginDetail.CustMobile);
            param[21] = new SqlParameter("@CustEmail", argCallLoginDetail.CustEmail);
            param[22] = new SqlParameter("@CustGender", argCallLoginDetail.CustGender);
            param[23] = new SqlParameter("@CustCountryCode", argCallLoginDetail.CustCountryCode);
            param[24] = new SqlParameter("@CustStateCode", argCallLoginDetail.CustStateCode);
            param[25] = new SqlParameter("@CustCity", argCallLoginDetail.CustCity);
            param[26] = new SqlParameter("@IsAssignToTechnician", argCallLoginDetail.IsAssignToTechnician);
            param[27] = new SqlParameter("@AssignTechNarration", argCallLoginDetail.AssignTechNarration);

            param[28] = new SqlParameter("@IsApproved", argCallLoginDetail.IsApproved);


            param[29] = new SqlParameter("@IsCallClosed", argCallLoginDetail.IsCallClosed);
            param[30] = new SqlParameter("@CallCloseDate", argCallLoginDetail.CallCloseDate);


            param[31] = new SqlParameter("@IsGoodsRec", argCallLoginDetail.IsGoodsRec);
            param[32] = new SqlParameter("@GRStatus", argCallLoginDetail.GRStatus);

            param[33] = new SqlParameter("@ReceivedDate", argCallLoginDetail.ReceivedDate);

            param[34] = new SqlParameter("@Quantity", argCallLoginDetail.Quantity);

            param[35] = new SqlParameter("@UOMCode", argCallLoginDetail.UOMCode);

            param[36] = new SqlParameter("@PartnerCode", argCallLoginDetail.PartnerCode);
            param[37] = new SqlParameter("@HLMaterialCode ", argCallLoginDetail.HLMaterialCode);
            param[38] = new SqlParameter("@HLItemNo", argCallLoginDetail.HLItemNo);
            param[39] = new SqlParameter("@Narration", argCallLoginDetail.Narration);
            param[40] = new SqlParameter("@RepairStatusCode", argCallLoginDetail.RepairStatusCode);

            param[41] = new SqlParameter("@DefectTypeDesc", argCallLoginDetail.DefectTypeDesc);
            param[42] = new SqlParameter("@EstTotal", argCallLoginDetail.EstTotal);
            param[43] = new SqlParameter("@EstAppStatus", argCallLoginDetail.EstAppStatus);
            param[44] = new SqlParameter("@EstAppDate", argCallLoginDetail.EstAppDate);

            param[45] = new SqlParameter("@AdvRefDocCode", argCallLoginDetail.AdvRefDocCode);
            param[46] = new SqlParameter("@AdvRefDocItemNo", argCallLoginDetail.AdvRefDocItemNo);
            param[47] = new SqlParameter("@AdvRecRefDocCode", argCallLoginDetail.AdvRecRefDocCode);
            param[48] = new SqlParameter("@AdvRecRefDocItemNo", argCallLoginDetail.AdvRecRefDocItemNo);
            param[49] = new SqlParameter("@MaterialDocTypeCode", argCallLoginDetail.MaterialDocTypeCode);
            param[50] = new SqlParameter("@StoreCode", argCallLoginDetail.StoreCode);
            param[51] = new SqlParameter("@StockIndicator", argCallLoginDetail.StockIndicator);

            param[52] = new SqlParameter("@ItemsReceived", argCallLoginDetail.ItemsReceived);
            param[53] = new SqlParameter("@IsCretificateIssued", argCallLoginDetail.IsCretificateIssued);
            param[54] = new SqlParameter("@CretificateIssueDate", argCallLoginDetail.CretificateIssueDate);


            param[56] = new SqlParameter("@RepairDocTypeCode", argCallLoginDetail.RepairDocTypeCode);
            param[57] = new SqlParameter("@MRevisionCode", argCallLoginDetail.MRevisionCode);
            param[58] = new SqlParameter("@IsRepairable", argCallLoginDetail.IsRepairable);

            param[59] = new SqlParameter("@ClientCode", argCallLoginDetail.ClientCode);
            param[60] = new SqlParameter("@CreatedBy", argCallLoginDetail.CreatedBy);
            param[61] = new SqlParameter("@ModifiedBy", argCallLoginDetail.ModifiedBy);

            param[62]           = new SqlParameter("@Type", SqlDbType.Char);
            param[62].Size      = 1;
            param[62].Direction = ParameterDirection.Output;

            param[63]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[63].Size      = 255;
            param[63].Direction = ParameterDirection.Output;

            param[64]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[64].Size      = 20;
            param[64].Direction = ParameterDirection.Output;

            int i = da.NExecuteNonQuery("Proc_UpdateCallLoginDetail", param);

            string strMessage  = Convert.ToString(param[63].Value);
            string strType     = Convert.ToString(param[62].Value);
            string strRetValue = Convert.ToString(param[64].Value);


            objErrorHandler.Type       = strType;
            objErrorHandler.MsgId      = 0;
            objErrorHandler.Module     = ErrorConstant.strInsertModule;
            objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
            objErrorHandler.Message    = strMessage.ToString();
            objErrorHandler.RowNo      = 0;
            objErrorHandler.FieldName  = "";
            objErrorHandler.LogCode    = "";
            lstErr.Add(objErrorHandler);
        }
        public ICollection <ErrorHandler> SaveCallLoginDetail(CallLoginDetail argCallLoginDetail)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsCallLoginDetailExists(argCallLoginDetail.CallCode, argCallLoginDetail.ItemNo, argCallLoginDetail.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertCallLoginDetail(argCallLoginDetail, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateCallLoginDetail(argCallLoginDetail, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandler.Type       = ErrorConstant.strAboartType;
                objErrorHandler.MsgId      = 0;
                objErrorHandler.Module     = ErrorConstant.strInsertModule;
                objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
                objErrorHandler.Message    = ex.Message.ToString();
                objErrorHandler.RowNo      = 0;
                objErrorHandler.FieldName  = "";
                objErrorHandler.LogCode    = "";
                lstErr.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }