public ActionResult SaveDrs(FFM_VESSEL_VM FNM)
        {
            List <SessionListnew> list = Session["SesDet"] as List <SessionListnew>;

            if (list == null)
            {
                return(Redirect("Login/InLogin"));
            }
            else
            {
                FNM.CMPYCODE = list[0].CmpyCode;
                FNM.UserName = list[0].user_name;
                return(Json(_FFM_VESSELService.SaveFFM_VESSEL(FNM), JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
        public FFM_VESSEL_VM EditFFM_VESSEL(string CmpyCode, string FFM_VESSEL_CODE)
        {
            ds = _EzBusinessHelper.ExecuteDataSet("Select * from FFM_VESSEL where CMPYCODE='" + CmpyCode + "' and FFM_VESSEL_CODE='" + FFM_VESSEL_CODE + "'  and Flag1=0");//
            dt = ds.Tables[0];
            DataRowCollection drc     = dt.Rows;
            FFM_VESSEL_VM     ObjList = new FFM_VESSEL_VM();

            foreach (DataRow dr in drc)
            {
                ObjList.CMPYCODE        = dr["CMPYCODE"].ToString();
                ObjList.FFM_VESSEL_CODE = dr["FFM_VESSEL_CODE"].ToString();
                ObjList.NAME            = dr["NAME"].ToString();
                ObjList.FLAG            = dr["FLAG"].ToString();
                ObjList.SCACCODE        = dr["SCACCODE"].ToString().Trim();
                ObjList.VESSEL_TYPE     = dr["VESSEL_TYPE"].ToString().Trim();
                ObjList.COUNTRY         = dr["COUNTRY"].ToString().Trim();
                ObjList.CARRIER         = dr["CARRIER"].ToString();
            }
            return(ObjList);
        }
Example #3
0
        //public List<SelectListItem> GetNationListEdit(string CmpyCode,string code)
        //{
        //    var itemCodes = _FFM_VESSELRepo.GetNationList(CmpyCode).Where(m => m.Code.ToString() == code).ToList()
        //                                 .Select(m => new SelectListItem { Value = m.Code, Text = string.Concat(m.Code, " - ", m.Name) })
        //                                 .ToList();

        //    return InsertFirstElementDDL(itemCodes);
        //}
        //public List<SelectListItem> GetContainerEdit(string CmpyCode,string Code)
        //{
        //    var itemCodes = _FFM_VESSELRepo.GetContainer(CmpyCode).Where(m => m.FFM_CNTR_CODE.ToString() == Code).ToList()
        //                                   .Select(m => new SelectListItem { Value = m.FFM_CNTR_CODE, Text = string.Concat(m.FFM_CNTR_CODE, " - ", m.NAME) })
        //                                   .ToList();

        //    return InsertFirstElementDDL(itemCodes);
        //}

        public FFM_VESSEL_VM SaveFFM_VESSEL(FFM_VESSEL_VM ac)
        {
            return(_FFM_VESSELRepo.SaveFFM_VESSEL(ac));
        }
Example #4
0
        public FFM_VESSEL_VM SaveFFM_VESSEL(FFM_VESSEL_VM FVS)
        {
            try
            {
                dte    = Convert.ToDateTime(DateTime.Now.ToString());
                dtstr1 = dte.ToString("yyyy-MM-dd hh:mm:ss tt");
                if (!FVS.EditFlag)
                {
                    int Stats1 = _EzBusinessHelper.ExecuteScalar("Select count(*) as [count1] from FFM_VESSEL where CMPYCODE='" + FVS.CMPYCODE + "' and FFM_VESSEL_CODE='" + FVS.FFM_VESSEL_CODE + "' and  Flag1=0");
                    if (Stats1 == 0)
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append("'" + FVS.CMPYCODE + "',");
                        sb.Append("'" + FVS.FFM_VESSEL_CODE + "',");
                        sb.Append("'" + FVS.FLAG + "',");
                        sb.Append("'" + FVS.NAME + "',");
                        sb.Append("'" + FVS.CARRIER + "',");
                        sb.Append("'" + FVS.SCACCODE + "',");
                        sb.Append("'" + FVS.VESSEL_TYPE + "',");
                        sb.Append("'" + FVS.UserName + "',");
                        sb.Append("'" + dtstr1 + "',");
                        sb.Append("'" + FVS.UserName + "',");
                        sb.Append("'" + dtstr1 + "',");
                        sb.Append("'" + FVS.COUNTRY + "')");

                        _EzBusinessHelper.ExecuteNonQuery("insert into FFM_VESSEL(CMPYCODE,FFM_VESSEL_CODE,FLAG,NAME,CARRIER,SCACCODE,VESSEL_TYPE,CREATED_BY,CREATED_ON,UPDATED_BY,UPDATED_ON,COUNTRY) values(" + sb.ToString() + "");
                        _EzBusinessHelper.ActivityLog(FVS.CMPYCODE, FVS.UserName, "Add FFM_VESSEL", FVS.FFM_VESSEL_CODE, Environment.MachineName);
                        FVS.SaveFlag     = true;
                        FVS.ErrorMessage = string.Empty;
                    }
                    else
                    {
                        FVS.SaveFlag     = false;
                        FVS.ErrorMessage = "Duplicate Record";
                    }
                    return(FVS);
                }
                var StatsEdit = _EzBusinessHelper.ExecuteScalarDec("Select count(*) from FFM_VESSEL where CMPYCODE='" + FVS.CMPYCODE + "' and FFM_VESSEL_CODE='" + FVS.FFM_VESSEL_CODE + "' and  Flag1=0");
                if (StatsEdit != 0)
                {
                    StringBuilder sb = new StringBuilder();

                    sb.Append("CARRIER='" + FVS.CARRIER + "',");
                    sb.Append("COUNTRY='" + FVS.COUNTRY + "',");
                    sb.Append("FLAG='" + FVS.FLAG + "',");
                    sb.Append("NAME='" + FVS.NAME + "',");
                    sb.Append("SCACCODE='" + FVS.SCACCODE + "',");
                    sb.Append("UPDATED_BY='" + FVS.UPDATED_BY + "',");
                    sb.Append("UPDATED_ON='" + dtstr1 + "',");
                    sb.Append("VESSEL_TYPE='" + FVS.VESSEL_TYPE + "'");

                    _EzBusinessHelper.ExecuteNonQuery("update FFM_VESSEL set  " + sb + " where CMPYCODE='" + FVS.CMPYCODE + "' and FFM_VESSEL_CODE='" + FVS.FFM_VESSEL_CODE + "' and  Flag1=0");
                    _EzBusinessHelper.ActivityLog(FVS.CMPYCODE, FVS.UserName, "Update FFM_VESSEL", FVS.FFM_VESSEL_CODE, Environment.MachineName);

                    FVS.SaveFlag     = true;
                    FVS.ErrorMessage = string.Empty;
                }
                else
                {
                    FVS.SaveFlag     = false;
                    FVS.ErrorMessage = "Record not available";
                }
            }
            catch (Exception ex)
            {
                FVS.SaveFlag = false;
            }

            return(FVS);
        }