Esempio n. 1
0
        public static List <IShipSoft> GetShipSoftData(int custId, int locId, bool isTagged, int month, int year, SearchCriteria searchCriteria)
        {
            string           strExecution = "[common].[uspGetShipSoft]";
            List <IShipSoft> lstShipSoft  = new List <IShipSoft>();

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@CustId", custId);
                oDq.AddIntegerParam("@LocId", locId);
                oDq.AddBooleanParam("@IsTagged", isTagged);
                oDq.AddIntegerParam("@Month", month);
                oDq.AddIntegerParam("@Year", year);
                oDq.AddVarcharParam("@SortExpression", 50, searchCriteria.SortExpression);
                oDq.AddVarcharParam("@SortDirection", 4, searchCriteria.SortDirection);
                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    IShipSoft shipSoft = new ShipSoftEntity(reader);
                    lstShipSoft.Add(shipSoft);
                }

                reader.Close();
            }

            return(lstShipSoft);
        }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateSave())
            {
                List <ShipSoftEntity> lstShipSoft = new List <ShipSoftEntity>();
                int  tranId   = 0;
                bool isTagged = (rblTag.SelectedValue == "1") ? true : false;

                for (int index = 0; index < gvwData.Rows.Count; index++)
                {
                    CheckBox    chkSel = (CheckBox)gvwData.Rows[index].FindControl("chkSel");
                    HiddenField hdnId  = (HiddenField)gvwData.Rows[index].FindControl("hdnId");

                    if (!ReferenceEquals(chkSel, null) && !ReferenceEquals(hdnId, null))
                    {
                        if (isTagged) //For tagged data, populate deselected data
                        {
                            if (!chkSel.Checked)
                            {
                                tranId = 0;

                                int.TryParse(hdnId.Value, out tranId);

                                if (tranId > 0)
                                {
                                    ShipSoftEntity shipSoft = new ShipSoftEntity();
                                    shipSoft.TranId = tranId;
                                    lstShipSoft.Add(shipSoft);
                                }
                            }
                        }
                        else //For untagged data, populate only selected data
                        {
                            if (chkSel.Checked)
                            {
                                tranId = 0;

                                int.TryParse(hdnId.Value, out tranId);

                                if (tranId > 0)
                                {
                                    ShipSoftEntity shipSoft = new ShipSoftEntity();
                                    shipSoft.TranId = tranId;
                                    lstShipSoft.Add(shipSoft);
                                }
                            }
                        }
                    }
                }

                if (lstShipSoft.Count > 0)
                {
                    new CommonBLL().TagCustomer(lstShipSoft, Convert.ToInt32(ddlCust.SelectedValue), Convert.ToInt32(ddlSales.SelectedValue), isTagged, _userId);
                    LoadShipSoftData();
                    GeneralFunctions.RegisterAlertScript(this, ResourceManager.GetStringWithoutName("ERR00005"));
                    //ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00005") + "');</script>", false);
                }
            }
        }
Esempio n. 3
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int tranId = 0;
            List <ShipSoftEntity> lstShipSoft = new List <ShipSoftEntity>();

            for (int index = 0; index < gvwData.Rows.Count; index++)
            {
                CheckBox    chkSel = (CheckBox)gvwData.Rows[index].FindControl("chkSel");
                HiddenField hdnId  = (HiddenField)gvwData.Rows[index].FindControl("hdnId");

                if (!ReferenceEquals(chkSel, null) && !ReferenceEquals(hdnId, null))
                {
                    if (chkSel.Checked)
                    {
                        tranId = 0;

                        int.TryParse(hdnId.Value, out tranId);

                        if (tranId > 0)
                        {
                            ShipSoftEntity shipSoft = new ShipSoftEntity();
                            shipSoft.TranId = tranId;
                            lstShipSoft.Add(shipSoft);
                        }
                    }
                }
            }

            if (lstShipSoft.Count > 0)
            {
                new CommonBLL().DeleteShipSoftData(lstShipSoft, _userId);
                LoadShipSoftData();
                GeneralFunctions.RegisterAlertScript(this, ResourceManager.GetStringWithoutName("ERR00006"));
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, ResourceManager.GetStringWithoutName("ERR00075"));
            }
        }
Esempio n. 4
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            //LoadShipSoftData();
            //upArea.Update();

            if (fuShipSoft.HasFile)
            {
                string fileExt = System.IO.Path.GetExtension(fuShipSoft.FileName);
                List <ShipSoftEntity> lstShipSoft = new List <ShipSoftEntity>();

                if (fileExt.ToUpper() == ".BLA")
                {
                    using (StreamReader reader = new StreamReader(fuShipSoft.FileContent, Encoding.Default))
                    {
                        while (!reader.EndOfStream)
                        {
                            string str = reader.ReadLine().Replace((char)29, '|');

                            string[] abc = str.Split('|');

                            if (abc.Length > 8)
                            {
                                try
                                {
                                    ShipSoftEntity shipSoft = new ShipSoftEntity();
                                    shipSoft.LocationName = Convert.ToString(abc[0]);
                                    shipSoft.ProspectName = Convert.ToString(abc[1]);
                                    shipSoft.BookingNo    = Descramble(Convert.ToString(abc[2]));
                                    shipSoft.BLANumber    = Descramble(Convert.ToString(abc[3]));
                                    shipSoft.VesselVoyage = Descramble(Convert.ToString(abc[4]));
                                    shipSoft.ShipperName  = Descramble(Convert.ToString(abc[5]));
                                    shipSoft.PortName     = Descramble(Convert.ToString(abc[6]));
                                    shipSoft.TEU          = Convert.ToInt32(Descramble(Convert.ToString(abc[7])));
                                    shipSoft.FEU          = Convert.ToInt32(Descramble(Convert.ToString(abc[8])));

                                    shipSoft.SOBDate = Convert.ToDateTime(Descramble(Convert.ToString(abc[9], _culture)));
                                    lstShipSoft.Add(shipSoft);
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                        }
                    }

                    if (lstShipSoft.Count > 0)
                    {
                        int dupCount     = 0;
                        int rowsAffected = 0;
                        new CommonBLL().SaveShipSoft(lstShipSoft, _userId, out rowsAffected, out dupCount);
                        string message = "Total Number of Records Processed: " + Convert.ToString(lstShipSoft.Count) + "\\r\\n";
                        message += "Total Number of Records Up-loaded: " + rowsAffected.ToString() + "\\r\\n";
                        message += "Total Number of Records Rejected: " + dupCount.ToString();
                        GeneralFunctions.RegisterAlertScript(this, message);
                    }
                }
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, ResourceManager.GetStringWithoutName("ERR00052"));
            }
        }