Ejemplo n.º 1
0
        public ResponseObj SaveTempTransTrip(TransporterVehicleTrip obj)
        {
            var res = _transdal.SaveTempTransTrip(obj);

            if (Convert.ToInt32(res.Value) > 0)
            {
                var TripRequestMsg = Convert.ToString(ConfigurationSettings.AppSettings["TripRequestMsg"]);
                // var LogisticIds = Convert.ToString(ConfigurationSettings.AppSettings["LogisticIds"]);
                // var idsList = CommonBal.GetListValue(LogisticIds);

                var idsList = new NotificationBal().GetFcmByRoleId(15);
                foreach (var item in idsList)
                {
                    //var fcmList = new NotificationBal().GetFcmByUserId(Convert.ToInt32(item));
                    CommonBal.SendNotification(item, TripRequestMsg, 15, "Trip");
                }
                /**********Mail Report of Trip*********/

                #region  Trip Sheet Mail send

                if (ConfigurationManager.AppSettings["TripCreateMailSend"] == "1")
                {
                    if (Convert.ToInt32(res.Value) > 0)
                    {
                        ReasonStatusDal _rsdal = new ReasonStatusDal();
                        var             DS     = _rsdal.Get_FoTripOrders(Convert.ToInt32(res.Value), obj.Mobile, "TT");
                        if (DS != null)
                        {
                            if (DS.Tables[0].Rows.Count > 0 && DS.Tables[1].Rows.Count > 0)
                            {
                                var sendToList  = DS.Tables[1].Rows[0]["ToList"].ToString();
                                var sendCCList  = DS.Tables[1].Rows[0]["CCList"].ToString();
                                var mailSubject = DS.Tables[1].Rows[0]["Subject"].ToString();
                                var mailBody    = string.Format(DS.Tables[1].Rows[0]["Body"].ToString(), DS.Tables[1].Rows[0]["OrderDate"].ToString());
                                var fileName    = DS.Tables[1].Rows[0]["FOName"].ToString() + "(" + obj.Mobile + ") " + DS.Tables[1].Rows[0]["OrderDate"].ToString();

                                ReportInXMail.SendMailForFoTripOrders(DS.Tables[0], sendToList, sendCCList, mailSubject, mailBody, fileName, Convert.ToInt32(obj.CreatedBy));
                            }
                        }
                    }
                }
                #endregion
            }
            return(res);
        }
        public ResponseObj SaveTempTransTrip(TransporterVehicleTrip obj)
        {
            SqlConnection connection;
            SqlCommand    command = new SqlCommand();
            int           flag    = 0;
            var           result  = new ResponseObj();

            connection = new SqlConnection(connetionString);
            var fName = obj.Transporter.Name;
            var lName = string.Empty;

            if (obj.Transporter.Name.Contains(" "))
            {
                fName = obj.Transporter.Name.Split(' ')[0];
                lName = obj.Transporter.Name.Split(' ')[1];
            }
            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SP_SAVETempTRIP_DETAIL";//SP_SAVETRIP_DETAIL

                command.Parameters.AddWithValue("@ORDER_IDS", obj.Orderid);

                SqlParameter TripId = new SqlParameter();
                TripId.ParameterName = "@TripID";
                TripId.DbType        = DbType.Int32;
                TripId.Direction     = ParameterDirection.Output;
                command.Parameters.Add(TripId);

                command.Parameters.AddWithValue("@PickupAddress", "NA");
                command.Parameters.AddWithValue("@VehicleTypeID", obj.VehicleId);
                command.Parameters.AddWithValue("@VehicleName", obj.VehicleName);
                command.Parameters.AddWithValue("@mobile", obj.Mobile);
                command.Parameters.AddWithValue("@vehicleNo", "NA");
                command.Parameters.AddWithValue("@StartKmReading", 0);
                command.Parameters.AddWithValue("@EndKmReading", 0);
                command.Parameters.AddWithValue("@ChargesPerKm", 0);
                command.Parameters.AddWithValue("@OtherCharges", 0);
                command.Parameters.AddWithValue("@LabourCharges", 0);
                command.Parameters.AddWithValue("@Remark", "NA");
                command.Parameters.AddWithValue("@CreateBy", Convert.ToInt32(obj.CreatedBy));
                command.Parameters.AddWithValue("@ModifiedBy", 0);
                command.Parameters.AddWithValue("@IsActive", 1);
                command.Parameters.AddWithValue("@TransporterId", obj.Transporter.UserId);
                command.Parameters.AddWithValue("@TransporterFName", fName);
                command.Parameters.AddWithValue("@TransporterLName", lName);
                command.Parameters.AddWithValue("@TransMobile", obj.Transporter.Mobile);
                command.Parameters.AddWithValue("@TransAddress", obj.Transporter.Address);
                command.Parameters.AddWithValue("@RuleId", obj.RuleId);
                command.Parameters.AddWithValue("@Fixedrateperday", obj.Fixedrateperday);
                command.Parameters.AddWithValue("@FuelCharges", obj.FuelCharges);
                command.Parameters.AddWithValue("@Priceperkm", obj.Priceperkm);
                command.Parameters.AddWithValue("@Mincharges", obj.Mincharges);
                command.Parameters.AddWithValue("@MinchargeUptoKm", obj.MinchargeUptoKm);
                command.Parameters.AddWithValue("@UpPrice", obj.UpPrice);
                command.Parameters.AddWithValue("@DownPrice", obj.DownPrice);
                command.Parameters.AddWithValue("@FixedPrice", obj.FixedPrice);
                command.Parameters.AddWithValue("@IsUpDown", Convert.ToBoolean(obj.IsUpDown));
                command.Parameters.AddWithValue("@ReasonId", obj.ReasonId);
                command.Parameters.AddWithValue("@Remarks", obj.Remarks);
                SqlParameter TripMSG = new SqlParameter();
                TripMSG.ParameterName = "@TripMsg";
                TripMSG.DbType        = DbType.String;
                TripMSG.Size          = 299;
                TripMSG.Direction     = ParameterDirection.Output;
                command.Parameters.Add(TripMSG);
                flag = command.ExecuteNonQuery();
                //if (flag > 0)
                //{
                result.Status = "Sucess";

                string GetTripID = command.Parameters["@TripID"].Value.ToString();
                // flag = int.Parse(GetTripID);
                result.Value = GetTripID;
                result.Msg   = command.Parameters["@TripMsg"].Value.ToString();
                //}
                command.Parameters.Clear();
                LogDal.MethodCallLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception ex)
            {
                result.Msg    = ex.Message;
                result.Status = "Failed";
                result.Value  = "-1";
                LogDal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, int.Parse("0"));
            }


            connection.Close();
            return(result);
        }